Explorar el Código

Pull after push

Brendan Abolivier hace 6 años
padre
commit
65257ab64f
Firmado por: Brendan Abolivier <contact@brendanabolivier.com> ID clave GPG: 8EF1500759F70623
Se han modificado 1 ficheros con 12 adiciones y 0 borrados
  1. 12
    0
      src/pusher/poller/poller.go

+ 12
- 0
src/pusher/poller/poller.go Ver fichero

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