Merge pull request #60 from pelotech/lint-strictly
Pass --strict to `helm lint` when so instructed
This commit is contained in:
commit
3c44be059e
|
@ -19,6 +19,7 @@ Linting is only triggered when the `helm_command` setting is "lint".
|
||||||
| values | list\<string\> | | Chart values to use as the `--set` argument to `helm lint`. |
|
| values | list\<string\> | | Chart values to use as the `--set` argument to `helm lint`. |
|
||||||
| string_values | list\<string\> | | Chart values to use as the `--set-string` argument to `helm lint`. |
|
| string_values | list\<string\> | | Chart values to use as the `--set-string` argument to `helm lint`. |
|
||||||
| values_files | list\<string\> | | Values to use as `--values` arguments to `helm lint`. |
|
| values_files | list\<string\> | | Values to use as `--values` arguments to `helm lint`. |
|
||||||
|
| lint_strictly | boolean | | Pass `--strict` to `helm lint`, to turn warnings into errors. |
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ type Config struct {
|
||||||
Chart string `` // Chart argument to use in applicable helm commands
|
Chart string `` // Chart argument to use in applicable helm commands
|
||||||
Release string `` // Release 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
|
Force bool `` // Pass --force to applicable helm commands
|
||||||
|
LintStrictly bool `split_words:"true"` // Pass --strict to `helm lint`
|
||||||
|
|
||||||
Stdout io.Writer `ignored:"true"`
|
Stdout io.Writer `ignored:"true"`
|
||||||
Stderr io.Writer `ignored:"true"`
|
Stderr io.Writer `ignored:"true"`
|
||||||
|
|
|
@ -134,6 +134,7 @@ var lint = func(cfg Config) []Step {
|
||||||
}
|
}
|
||||||
steps = append(steps, &run.Lint{
|
steps = append(steps, &run.Lint{
|
||||||
Chart: cfg.Chart,
|
Chart: cfg.Chart,
|
||||||
|
Strict: cfg.LintStrictly,
|
||||||
})
|
})
|
||||||
|
|
||||||
return steps
|
return steps
|
||||||
|
|
|
@ -300,6 +300,7 @@ func (suite *PlanTestSuite) TestAddRepos() {
|
||||||
func (suite *PlanTestSuite) TestLint() {
|
func (suite *PlanTestSuite) TestLint() {
|
||||||
cfg := Config{
|
cfg := Config{
|
||||||
Chart: "./flow",
|
Chart: "./flow",
|
||||||
|
LintStrictly: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
steps := lint(cfg)
|
steps := lint(cfg)
|
||||||
|
@ -307,6 +308,7 @@ func (suite *PlanTestSuite) TestLint() {
|
||||||
|
|
||||||
want := &run.Lint{
|
want := &run.Lint{
|
||||||
Chart: "./flow",
|
Chart: "./flow",
|
||||||
|
Strict: true,
|
||||||
}
|
}
|
||||||
suite.Equal(want, steps[0])
|
suite.Equal(want, steps[0])
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
// Lint is an execution step that calls `helm lint` when executed.
|
// Lint is an execution step that calls `helm lint` when executed.
|
||||||
type Lint struct {
|
type Lint struct {
|
||||||
Chart string
|
Chart string
|
||||||
|
Strict bool
|
||||||
cmd cmd
|
cmd cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +42,9 @@ func (l *Lint) Prepare(cfg Config) error {
|
||||||
for _, vFile := range cfg.ValuesFiles {
|
for _, vFile := range cfg.ValuesFiles {
|
||||||
args = append(args, "--values", vFile)
|
args = append(args, "--values", vFile)
|
||||||
}
|
}
|
||||||
|
if l.Strict {
|
||||||
|
args = append(args, "--strict")
|
||||||
|
}
|
||||||
|
|
||||||
args = append(args, l.Chart)
|
args = append(args, l.Chart)
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ func (suite *LintTestSuite) TestPrepareWithLintFlags() {
|
||||||
|
|
||||||
l := Lint{
|
l := Lint{
|
||||||
Chart: "./uk/top_40",
|
Chart: "./uk/top_40",
|
||||||
|
Strict: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
command = func(path string, args ...string) cmd {
|
command = func(path string, args ...string) cmd {
|
||||||
|
@ -97,6 +98,7 @@ func (suite *LintTestSuite) TestPrepareWithLintFlags() {
|
||||||
"--set-string", "version=2.0",
|
"--set-string", "version=2.0",
|
||||||
"--values", "/usr/local/underrides",
|
"--values", "/usr/local/underrides",
|
||||||
"--values", "/usr/local/overrides",
|
"--values", "/usr/local/overrides",
|
||||||
|
"--strict",
|
||||||
"./uk/top_40"}, args)
|
"./uk/top_40"}, args)
|
||||||
|
|
||||||
return suite.mockCmd
|
return suite.mockCmd
|
||||||
|
|
Loading…
Reference in a new issue