diff --git a/docs/parameter_reference.md b/docs/parameter_reference.md index 9575d41..947b86c 100644 --- a/docs/parameter_reference.md +++ b/docs/parameter_reference.md @@ -19,6 +19,7 @@ Linting is only triggered when the `helm_command` setting is "lint". | values | list\ | | Chart values to use as the `--set` argument to `helm lint`. | | string_values | list\ | | Chart values to use as the `--set-string` argument to `helm lint`. | | values_files | list\ | | Values to use as `--values` arguments to `helm lint`. | +| lint_strictly | boolean | | Pass `--strict` to `helm lint`, to turn warnings into errors. | ## Installation @@ -61,7 +62,9 @@ Uninstallations are triggered when the `helm_command` setting is "uninstall" or ### Where to put settings -Any setting can go in either the `settings` or `environment` section. +Any setting can go in either the `settings` or `environment` section. If a setting exists in _both_ sections, the version in `environment` will override the version in `settings`. + +We recommend putting all drone-helm3 configuration in the `settings` block and limiting the `environment` block to variables that are used when building your charts. ### Formatting non-string values diff --git a/internal/helm/config.go b/internal/helm/config.go index 2365ce2..1940de2 100644 --- a/internal/helm/config.go +++ b/internal/helm/config.go @@ -42,6 +42,7 @@ type Config struct { Chart string `` // Chart argument to use in applicable helm commands Release string `` // Release argument to use in applicable helm commands Force bool `` // Pass --force to applicable helm commands + LintStrictly bool `split_words:"true"` // Pass --strict to `helm lint` Stdout io.Writer `ignored:"true"` Stderr io.Writer `ignored:"true"` diff --git a/internal/helm/plan.go b/internal/helm/plan.go index ce2dabe..bf3eb44 100644 --- a/internal/helm/plan.go +++ b/internal/helm/plan.go @@ -137,6 +137,7 @@ var lint = func(cfg Config) []Step { Values: cfg.Values, StringValues: cfg.StringValues, ValuesFiles: cfg.ValuesFiles, + Strict: cfg.LintStrictly, }) return steps diff --git a/internal/helm/plan_test.go b/internal/helm/plan_test.go index a87a7d5..fbb3eaf 100644 --- a/internal/helm/plan_test.go +++ b/internal/helm/plan_test.go @@ -303,6 +303,7 @@ func (suite *PlanTestSuite) TestLint() { Values: "steadfastness,forthrightness", StringValues: "tensile_strength,flexibility", ValuesFiles: []string{"/root/price_inventory.yml"}, + LintStrictly: true, } steps := lint(cfg) @@ -313,6 +314,7 @@ func (suite *PlanTestSuite) TestLint() { Values: "steadfastness,forthrightness", StringValues: "tensile_strength,flexibility", ValuesFiles: []string{"/root/price_inventory.yml"}, + Strict: true, } suite.Equal(want, steps[0]) } diff --git a/internal/run/lint.go b/internal/run/lint.go index 2ac7361..db4e13b 100644 --- a/internal/run/lint.go +++ b/internal/run/lint.go @@ -10,6 +10,7 @@ type Lint struct { Values string StringValues string ValuesFiles []string + Strict bool cmd cmd } @@ -44,6 +45,9 @@ func (l *Lint) Prepare(cfg Config) error { for _, vFile := range l.ValuesFiles { args = append(args, "--values", vFile) } + if l.Strict { + args = append(args, "--strict") + } args = append(args, l.Chart) diff --git a/internal/run/lint_test.go b/internal/run/lint_test.go index 7beb0dd..f46ad63 100644 --- a/internal/run/lint_test.go +++ b/internal/run/lint_test.go @@ -87,6 +87,7 @@ func (suite *LintTestSuite) TestPrepareWithLintFlags() { Values: "width=5", StringValues: "version=2.0", ValuesFiles: []string{"/usr/local/underrides", "/usr/local/overrides"}, + Strict: true, } command = func(path string, args ...string) cmd { @@ -96,6 +97,7 @@ func (suite *LintTestSuite) TestPrepareWithLintFlags() { "--set-string", "version=2.0", "--values", "/usr/local/underrides", "--values", "/usr/local/overrides", + "--strict", "./uk/top_40"}, args) return suite.mockCmd