From 8582bb0e89d2954b4cee2c5561101fa02e22798b Mon Sep 17 00:00:00 2001 From: Itxaka Date: Mon, 12 Apr 2021 15:18:00 +0200 Subject: [PATCH] Fix Unmarshall of the shared-deps for linting Use strict to make sure we have the proper Dependency Signed-off-by: Itxaka --- pkg/lint/rules/annotations.go | 2 +- pkg/lint/rules/testdata/badchartbrokenhypperdeps/Chart.yaml | 3 ++- pkg/lint/rules/testdata/goodchart/Chart.yaml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/lint/rules/annotations.go b/pkg/lint/rules/annotations.go index da3c0edf..e046edee 100644 --- a/pkg/lint/rules/annotations.go +++ b/pkg/lint/rules/annotations.go @@ -74,7 +74,7 @@ func validateChartHypperSharedDeps(chart *helmChart.Metadata) error { func validateChartHypperSharedDepsCorrect(chart *helmChart.Metadata) error { depList := chart.Annotations["hypper.cattle.io/shared-dependencies"] var yamlDeps []*helmChart.Dependency - if err := yaml.Unmarshal([]byte(depList), &yamlDeps); err != nil { + if err := yaml.UnmarshalStrict([]byte(depList), &yamlDeps); err != nil { return errors.New("Shared dependencies list is broken, please check the correct format") } return nil diff --git a/pkg/lint/rules/testdata/badchartbrokenhypperdeps/Chart.yaml b/pkg/lint/rules/testdata/badchartbrokenhypperdeps/Chart.yaml index 44fd70aa..bcf8ebb4 100644 --- a/pkg/lint/rules/testdata/badchartbrokenhypperdeps/Chart.yaml +++ b/pkg/lint/rules/testdata/badchartbrokenhypperdeps/Chart.yaml @@ -7,5 +7,6 @@ appVersion: "1.16.0" annotations: "hypper.cattle.io/release-name": "release" "hypper.cattle.io/namespace": "namespace" - "hypper.cattle.io/shared-dependencies": "jojo" + "hypper.cattle.io/shared-dependencies": | + - what: ever diff --git a/pkg/lint/rules/testdata/goodchart/Chart.yaml b/pkg/lint/rules/testdata/goodchart/Chart.yaml index 207b4c05..d3796ee0 100644 --- a/pkg/lint/rules/testdata/goodchart/Chart.yaml +++ b/pkg/lint/rules/testdata/goodchart/Chart.yaml @@ -9,4 +9,4 @@ annotations: "hypper.cattle.io/release-name": "release" "hypper.cattle.io/namespace": "namespace" "hypper.cattle.io/shared-dependencies": | - - key: value + - name: shareddep