diff --git a/changes/fingerprint.go b/changes/fingerprint.go index 2af020ab..c652de3b 100644 --- a/changes/fingerprint.go +++ b/changes/fingerprint.go @@ -30,6 +30,7 @@ func init() { "DURATION", `\s+\d+(.\d+){0,1}(ms|s|h|d|m)`, "SHA256", `[a-z0-9]{64}`, "NUMBER", `^\d+$`, + "HEX16", `[0-9a-f]{16}`, // matches a 16 character long hex string ) } diff --git a/changes/fingerprint_test.go b/changes/fingerprint_test.go index e36451bf..b7db349b 100644 --- a/changes/fingerprint_test.go +++ b/changes/fingerprint_test.go @@ -55,10 +55,17 @@ var _ = Describe("Change Fingerprints", func() { Expect(err2).ToNot(HaveOccurred()) Expect(fp1).To(Equal(fp2)) }) + + It("16 character long hex should be ignored", func() { + fp1, err1 := changes.Fingerprint(readChange("helm_upgrade_failed.json")) + fp2, err2 := changes.Fingerprint(readChange("helm_upgrade_failed_2.json")) + Expect(err1).ToNot(HaveOccurred()) + Expect(err2).ToNot(HaveOccurred()) + Expect(fp1).To(Equal(fp2)) + }) }) func TestChangeFingerprints(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Change Fingerprints Suite") } diff --git a/changes/testdata/helm_upgrade_failed.json b/changes/testdata/helm_upgrade_failed.json new file mode 100644 index 00000000..2d6684a9 --- /dev/null +++ b/changes/testdata/helm_upgrade_failed.json @@ -0,0 +1,29 @@ +{ + "details": { + "reason": "UpgradeFailed", + "source": { + "component": "helm-controller" + }, + "message": "Helm upgrade failed for release mission-control-agent/mission-control-kubernetes-bundle with chart mission-control-kubernetes@0.1.69: values don't meet the specifications of the schema(s) in the following chart(s):\nmission-control-kubernetes:\n- (root): Additional property interval is not allowed\n\nLast Helm logs:\n\n2024-10-09T04:46:13.116068801Z: preparing upgrade for mission-control-kubernetes-bundle\n2024-10-09T04:46:13.156697628Z: resetting values to the chart's original version", + "metadata": { + "uid": "852af766-4928-49d5-a2a6-a5668e3715e3", + "name": "mission-control-kubernetes-bundle.17fcaf5d944b5886", + "namespace": "mission-control-agent", + "annotations": { + "helm.toolkit.fluxcd.io/token": "sha256:eb7505628756567105a575c2dcaf473756212793a2b43537b976db9e18c7b233", + "helm.toolkit.fluxcd.io/revision": "0.1.69", + "helm.toolkit.fluxcd.io/app-version": "1.0.0" + }, + "resourceVersion": "43136301", + "creationTimestamp": "2024-10-09T04:46:13Z" + }, + "involvedObject": { + "uid": "e280b462-01b2-41a4-a53a-50541240a3e2", + "kind": "HelmRelease", + "name": "mission-control-kubernetes-bundle", + "namespace": "mission-control-agent", + "apiVersion": "helm.toolkit.fluxcd.io/v2", + "resourceVersion": "43130040" + } + } +} diff --git a/changes/testdata/helm_upgrade_failed_2.json b/changes/testdata/helm_upgrade_failed_2.json new file mode 100644 index 00000000..e659b794 --- /dev/null +++ b/changes/testdata/helm_upgrade_failed_2.json @@ -0,0 +1,29 @@ +{ + "details": { + "reason": "UpgradeFailed", + "source": { + "component": "helm-controller" + }, + "message": "Helm upgrade failed for release mission-control-agent/mission-control-kubernetes-bundle with chart mission-control-kubernetes@0.1.69: values don't meet the specifications of the schema(s) in the following chart(s):\nmission-control-kubernetes:\n- (root): Additional property interval is not allowed\n\nLast Helm logs:\n\n2024-10-09T03:31:10.99090145Z: preparing upgrade for mission-control-kubernetes-bundle\n2024-10-09T03:31:11.022444234Z: resetting values to the chart's original version", + "metadata": { + "uid": "552e28a9-54a4-4ba7-8dc2-a68924cbba60", + "name": "mission-control-kubernetes-bundle.17fcab45546704af", + "namespace": "mission-control-agent", + "annotations": { + "helm.toolkit.fluxcd.io/token": "sha256:eb7505628756567105a575c2dcaf473756212793a2b43537b976db9e18c7b233", + "helm.toolkit.fluxcd.io/revision": "0.1.69", + "helm.toolkit.fluxcd.io/app-version": "1.0.0" + }, + "resourceVersion": "43130433", + "creationTimestamp": "2024-10-09T03:31:11Z" + }, + "involvedObject": { + "uid": "e280b462-01b2-41a4-a53a-50541240a3e2", + "kind": "HelmRelease", + "name": "mission-control-kubernetes-bundle", + "namespace": "mission-control-agent", + "apiVersion": "helm.toolkit.fluxcd.io/v2", + "resourceVersion": "43098665" + } + } +}