Browse Source

Pull after push

Brendan Abolivier 6 years ago
parent
commit
65257ab64f
Signed by: Brendan Abolivier <contact@brendanabolivier.com> GPG key ID: 8EF1500759F70623
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      src/pusher/poller/poller.go

+ 12
- 0
src/pusher/poller/poller.go View File

@@ -6,6 +6,7 @@ import (
6 6
 	"config"
7 7
 	"git"
8 8
 	"grafana"
9
+	puller "puller"
9 10
 	"pusher/common"
10 11
 
11 12
 	"github.com/sirupsen/logrus"
@@ -85,6 +86,17 @@ func poller(
85 86
 			if delRemoved {
86 87
 				common.DeleteDashboards(removed, mergedContents, client)
87 88
 			}
89
+
90
+			// Grafana will auto-update the version number after we pushed the new
91
+			// dashboards, so we use the puller mechanic to pull the updated numbers and
92
+			// commit them in the git repo.
93
+			if err = puller.PullGrafanaAndCommit(client, cfg); err != nil {
94
+				logrus.WithFields(logrus.Fields{
95
+					"error":      err,
96
+					"repo":       cfg.Git.User + "@" + cfg.Git.URL,
97
+					"clone_path": cfg.Git.ClonePath,
98
+				}).Error("Call to puller returned an error")
99
+			}
88 100
 		}
89 101
 
90 102
 		previousCommit = latestCommit