Repository: NetApp/harvest
Pull request #1885 (2023-03-31 16:34:28)

ci: prune untagged images
ci: change commitlint to use singular nouns


Patch:
diff --git a/.github/workflows/delete-untagged-images.yml b/.github/workflows/delete-untagged-images.yml
new file mode 100644
index 00000000..d85090b9
--- /dev/null
+++ b/.github/workflows/delete-untagged-images.yml
@@ -0,0 +1,19 @@
+name: Prune Untagged Images
+
+on:
+  workflow_dispatch:
+  schedule:
+    - cron: '0 0 * * 6' # every Saturday at midnight
+
+jobs:
+  purge-image:
+    name: Prune untagged images
+    runs-on: ubuntu-latest
+    steps:
+      - name: Prune all untagged images
+        uses: actions/delete-package-versions@v4
+        with:
+          package-name: 'harvest'
+          package-type: 'container'
+          min-versions-to-keep: 1
+          delete-only-untagged-versions: 'true'
\ No newline at end of file
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 5dbb7a23..b184c802 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -38,7 +38,7 @@ jobs:
       run: go build -v ./...
 
     - name: Test
-      run: go test -v -race -shuffle=on ./...
+      run: go test -race -shuffle=on ./...
 
     - name: Check code formatting using gofmt
       uses: Jerome1337/gofmt-action@v1.0.5
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bf82a3a6..53a5ac19 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -57,7 +57,7 @@ All Harvest commits should follow this form - a GitHub action will reject commit
 * `build`
 * `chore` - bump version of dependencies
 * `ci`
-* `docs`
+* `doc`
 * `feat` - new feature, big or small
 * `fix`
 * `perf`
diff --git a/commitlint.config.js b/commitlint.config.js
index b72bbbe7..0929571f 100644
--- a/commitlint.config.js
+++ b/commitlint.config.js
@@ -19,6 +19,23 @@ module.exports = {
                 'poller',
                 'prometheus',
             ]
+        ],
+        'type-enum': [
+            2,
+            'always',
+            [
+                'build',
+                'chore',
+                'ci',
+                'doc',
+                'feat',
+                'fix',
+                'perf',
+                'refactor',
+                'revert',
+                'style',
+                'test'
+            ]
         ]
     }
 };
diff --git a/grafana/dashboards/storagegrid/overview.json b/grafana/dashboards/storagegrid/overview.json
index 9b99fe9c..9bec4e81 100644
--- a/grafana/dashboards/storagegrid/overview.json
+++ b/grafana/dashboards/storagegrid/overview.json
@@ -1995,9 +1995,9 @@
           "color": {
             "cardColor": "#b4ff00",
             "colorScale": "sqrt",
-            "colorScheme": "interpolateTurbo",
+            "colorScheme": "interpolateRdYlGn",
             "exponent": 0.5,
-            "mode": "opacity"
+            "mode": "spectrum"
           },
           "dataFormat": "tsbuckets",
           "datasource": "${DS_PROMETHEUS}",
@@ -2061,9 +2061,9 @@
           "color": {
             "cardColor": "#b4ff00",
             "colorScale": "sqrt",
-            "colorScheme": "interpolateTurbo",
+            "colorScheme": "interpolateRdYlGn",
             "exponent": 0.5,
-            "mode": "opacity"
+            "mode": "spectrum"
           },
           "dataFormat": "tsbuckets",
           "datasource": "${DS_PROMETHEUS}",


Test patch:
diff --git a/cmd/tools/grafana/dashboard_test.go b/cmd/tools/grafana/dashboard_test.go
index 91a87068..51665511 100644
--- a/cmd/tools/grafana/dashboard_test.go
+++ b/cmd/tools/grafana/dashboard_test.go
@@ -871,3 +871,36 @@ func checkDashboardRefresh(t *testing.T, path string, data []byte) {
 		return true
 	})
 }
+
+func TestHeatmapSettings(t *testing.T) {
+	visitDashboards(
+		[]string{"../../../grafana/dashboards/cmode", "../../../grafana/dashboards/storagegrid"},
+		func(path string, data []byte) {
+			checkHeatmapSettings(t, shortPath(path), data)
+		},
+	)
+}
+
+func checkHeatmapSettings(t *testing.T, path string, data []byte) {
+	dashPath := shortPath(path)
+	const (
+		wantColorScheme = "interpolateRdYlGn"
+		wantColorMode   = "spectrum"
+	)
+	visitAllPanels(data, func(path string, key, value gjson.Result) {
+		panelType := value.Get("type").String()
+		if panelType != "heatmap" {
+			return
+		}
+		colorScheme := value.Get("color.colorScheme").String()
+		colorMode := value.Get("color.mode").String()
+		if colorScheme != wantColorScheme {
+			t.Errorf(`dashboard=%s path=%s panel="%s" got color.scheme=%s, want=%s`,
+				dashPath, path, value.Get("title").String(), colorScheme, wantColorScheme)
+		}
+		if colorMode != wantColorMode {
+			t.Errorf(`dashboard=%s path=%s panel="%s" got color.mode=%s, want=%s`,
+				dashPath, path, value.Get("title").String(), colorMode, wantColorMode)
+		}
+	})
+}
diff --git a/pkg/conf/conf_test.go b/pkg/conf/conf_test.go
index 92742d18..c461dc66 100644
--- a/pkg/conf/conf_test.go
+++ b/pkg/conf/conf_test.go
@@ -191,10 +191,7 @@ func TestFlowStyle(t *testing.T) {
 
 func TestUniqueExportersByType(t *testing.T) {
 	path := "../../cmd/tools/doctor/testdata/testConfig.yml"
-	err := LoadHarvestConfig(path)
-	if err != nil {
-		panic(err)
-	}
+	TestLoadHarvestConfig(path)
 	poller2, _ := PollerNamed("overlapping")
 	t.Run("Exporters are unique by type", func(t *testing.T) {
 		exporters := GetUniqueExporters(poller2.Exporters)