|
@@ -5,6 +5,7 @@ import (
|
5
|
5
|
"encoding/json"
|
6
|
6
|
"io/ioutil"
|
7
|
7
|
"os"
|
|
8
|
+ "strings"
|
8
|
9
|
|
9
|
10
|
"config"
|
10
|
11
|
"git"
|
|
@@ -19,9 +20,10 @@ type diffVersion struct {
|
19
|
20
|
newVersion int
|
20
|
21
|
}
|
21
|
22
|
|
22
|
|
-// PullGrafanaAndCommit pulls all the dashboards from Grafana then commits each
|
23
|
|
-// of them to Git except for those that have a newer or equal version number
|
24
|
|
-// already versionned in the repo
|
|
23
|
+// PullGrafanaAndCommit pulls all the dashboards from Grafana except the ones
|
|
24
|
+// which name/slug starts with "test", then commits each of them to Git except
|
|
25
|
+// for those that have a newer or equal version number already versionned in
|
|
26
|
+// the repo.
|
25
|
27
|
func PullGrafanaAndCommit(client *grafana.Client, cfg *config.Config) error {
|
26
|
28
|
// Clone or pull the repo
|
27
|
29
|
repo, err := git.Sync(cfg.Git)
|
|
@@ -50,6 +52,11 @@ func PullGrafanaAndCommit(client *grafana.Client, cfg *config.Config) error {
|
50
|
52
|
|
51
|
53
|
// Iterate over the dashboards URIs
|
52
|
54
|
for _, uri := range uris {
|
|
55
|
+ // Don't process any dashboard which name/slug starts with "test"
|
|
56
|
+ if strings.HasPrefix(uri, "db/test") {
|
|
57
|
+ continue
|
|
58
|
+ }
|
|
59
|
+
|
53
|
60
|
// Retrieve the dashboard JSON
|
54
|
61
|
dashboard, err := client.GetDashboard(uri)
|
55
|
62
|
if err != nil {
|