瀏覽代碼

Pull after push

Brendan Abolivier 6 年之前
父節點
當前提交
65257ab64f
簽署人: Brendan Abolivier <contact@brendanabolivier.com> GPG 金鑰 ID: 8EF1500759F70623
共有 1 個文件被更改,包括 12 次插入0 次删除
  1. 12
    0
      src/pusher/poller/poller.go

+ 12
- 0
src/pusher/poller/poller.go 查看文件

@@ -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