Merge branch 'master' into keep-history

This commit is contained in:
Erin Call
2020-01-02 13:26:53 -08:00
committed by GitHub
8 changed files with 82 additions and 61 deletions

View File

@@ -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
}

View File

@@ -6,9 +6,12 @@ import (
// Lint is an execution step that calls `helm lint` when executed.
type Lint struct {
Chart string
Strict bool
cmd cmd
Chart string
Values string
StringValues string
ValuesFiles []string
Strict bool
cmd cmd
}
// Execute executes the `helm lint` command.
@@ -33,13 +36,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)
}
if l.Strict {

View File

@@ -80,15 +80,14 @@ 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",
Strict: true,
Strict: true,
}
command = func(path string, args ...string) cmd {

View File

@@ -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)
}

View File

@@ -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",