Put step-specific config in those steps [#61]
This is just something that's been bugging me for a while--they're specific to Lint and Upgrade, so that's where they belong.
This commit is contained in:
@@ -6,11 +6,8 @@ import (
|
||||
|
||||
// Config contains configuration applicable to all helm commands
|
||||
type Config struct {
|
||||
Debug bool
|
||||
Values string
|
||||
StringValues string
|
||||
ValuesFiles []string
|
||||
Namespace string
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
Debug bool
|
||||
Namespace string
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
}
|
||||
|
||||
@@ -6,8 +6,11 @@ import (
|
||||
|
||||
// Lint is an execution step that calls `helm lint` when executed.
|
||||
type Lint struct {
|
||||
Chart string
|
||||
cmd cmd
|
||||
Chart string
|
||||
Values string
|
||||
StringValues string
|
||||
ValuesFiles []string
|
||||
cmd cmd
|
||||
}
|
||||
|
||||
// Execute executes the `helm lint` command.
|
||||
@@ -32,13 +35,13 @@ func (l *Lint) Prepare(cfg Config) error {
|
||||
|
||||
args = append(args, "lint")
|
||||
|
||||
if cfg.Values != "" {
|
||||
args = append(args, "--set", cfg.Values)
|
||||
if l.Values != "" {
|
||||
args = append(args, "--set", l.Values)
|
||||
}
|
||||
if cfg.StringValues != "" {
|
||||
args = append(args, "--set-string", cfg.StringValues)
|
||||
if l.StringValues != "" {
|
||||
args = append(args, "--set-string", l.StringValues)
|
||||
}
|
||||
for _, vFile := range cfg.ValuesFiles {
|
||||
for _, vFile := range l.ValuesFiles {
|
||||
args = append(args, "--values", vFile)
|
||||
}
|
||||
|
||||
|
||||
@@ -80,16 +80,15 @@ func (suite *LintTestSuite) TestPrepareRequiresChart() {
|
||||
func (suite *LintTestSuite) TestPrepareWithLintFlags() {
|
||||
defer suite.ctrl.Finish()
|
||||
|
||||
cfg := Config{
|
||||
cfg := Config{}
|
||||
|
||||
l := Lint{
|
||||
Chart: "./uk/top_40",
|
||||
Values: "width=5",
|
||||
StringValues: "version=2.0",
|
||||
ValuesFiles: []string{"/usr/local/underrides", "/usr/local/overrides"},
|
||||
}
|
||||
|
||||
l := Lint{
|
||||
Chart: "./uk/top_40",
|
||||
}
|
||||
|
||||
command = func(path string, args ...string) cmd {
|
||||
suite.Equal(helmBin, path)
|
||||
suite.Equal([]string{"lint",
|
||||
|
||||
@@ -12,6 +12,9 @@ type Upgrade struct {
|
||||
ChartVersion string
|
||||
DryRun bool
|
||||
Wait bool
|
||||
Values string
|
||||
StringValues string
|
||||
ValuesFiles []string
|
||||
ReuseValues bool
|
||||
Timeout string
|
||||
Force bool
|
||||
@@ -62,13 +65,13 @@ func (u *Upgrade) Prepare(cfg Config) error {
|
||||
if u.Force {
|
||||
args = append(args, "--force")
|
||||
}
|
||||
if cfg.Values != "" {
|
||||
args = append(args, "--set", cfg.Values)
|
||||
if u.Values != "" {
|
||||
args = append(args, "--set", u.Values)
|
||||
}
|
||||
if cfg.StringValues != "" {
|
||||
args = append(args, "--set-string", cfg.StringValues)
|
||||
if u.StringValues != "" {
|
||||
args = append(args, "--set-string", u.StringValues)
|
||||
}
|
||||
for _, vFile := range cfg.ValuesFiles {
|
||||
for _, vFile := range u.ValuesFiles {
|
||||
args = append(args, "--values", vFile)
|
||||
}
|
||||
|
||||
|
||||
@@ -91,20 +91,19 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
|
||||
u := Upgrade{
|
||||
Chart: "hot_ac",
|
||||
Release: "maroon_5_memories",
|
||||
ChartVersion: "radio_edit", //-version
|
||||
DryRun: true, //-run
|
||||
Wait: true, //-wait
|
||||
ReuseValues: true, //-values
|
||||
Timeout: "sit_in_the_corner", //-timeout
|
||||
Force: true, //-force
|
||||
}
|
||||
|
||||
cfg := Config{
|
||||
ChartVersion: "radio_edit",
|
||||
DryRun: true,
|
||||
Wait: true,
|
||||
Values: "age=35",
|
||||
StringValues: "height=5ft10in",
|
||||
ValuesFiles: []string{"/usr/local/stats", "/usr/local/grades"},
|
||||
ReuseValues: true,
|
||||
Timeout: "sit_in_the_corner",
|
||||
Force: true,
|
||||
}
|
||||
|
||||
cfg := Config{}
|
||||
|
||||
command = func(path string, args ...string) cmd {
|
||||
suite.Equal(helmBin, path)
|
||||
suite.Equal([]string{"upgrade", "--install",
|
||||
|
||||
Reference in New Issue
Block a user