Merge branch 'master' into keep-history

This commit is contained in:
Erin Call 2020-01-02 13:26:53 -08:00 committed by GitHub
commit 8d8bcf78a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 82 additions and 61 deletions

11
.github/ISSUE_TEMPLATE/documentation.md vendored Normal file
View file

@ -0,0 +1,11 @@
---
name: Documentation
about: Docs you'd like to see, or questions about existing docs
title: ''
labels: documentation
assignees: ''
---
**What needs explanation:**
<!-- e.g. "what happens when ____", "how do I ___", etc. -->

View file

@ -30,9 +30,6 @@ func NewPlan(cfg Config) (*Plan, error) {
cfg: cfg,
runCfg: run.Config{
Debug: cfg.Debug,
Values: cfg.Values,
StringValues: cfg.StringValues,
ValuesFiles: cfg.ValuesFiles,
Namespace: cfg.Namespace,
Stdout: cfg.Stdout,
Stderr: cfg.Stderr,
@ -106,6 +103,9 @@ var upgrade = func(cfg Config) []Step {
ChartVersion: cfg.ChartVersion,
DryRun: cfg.DryRun,
Wait: cfg.Wait,
Values: cfg.Values,
StringValues: cfg.StringValues,
ValuesFiles: cfg.ValuesFiles,
ReuseValues: cfg.ReuseValues,
Timeout: cfg.Timeout,
Force: cfg.Force,
@ -135,6 +135,9 @@ var lint = func(cfg Config) []Step {
}
steps = append(steps, &run.Lint{
Chart: cfg.Chart,
Values: cfg.Values,
StringValues: cfg.StringValues,
ValuesFiles: cfg.ValuesFiles,
Strict: cfg.LintStrictly,
})

View file

@ -35,9 +35,6 @@ func (suite *PlanTestSuite) TestNewPlan() {
cfg := Config{
Command: "help",
Debug: false,
Values: "steadfastness,forthrightness",
StringValues: "tensile_strength,flexibility",
ValuesFiles: []string{"/root/price_inventory.yml"},
Namespace: "outer",
Stdout: &stdout,
Stderr: &stderr,
@ -45,9 +42,6 @@ func (suite *PlanTestSuite) TestNewPlan() {
runCfg := run.Config{
Debug: false,
Values: "steadfastness,forthrightness",
StringValues: "tensile_strength,flexibility",
ValuesFiles: []string{"/root/price_inventory.yml"},
Namespace: "outer",
Stdout: &stdout,
Stderr: &stderr,
@ -139,6 +133,9 @@ func (suite *PlanTestSuite) TestUpgrade() {
ChartVersion: "seventeen",
DryRun: true,
Wait: true,
Values: "steadfastness,forthrightness",
StringValues: "tensile_strength,flexibility",
ValuesFiles: []string{"/root/price_inventory.yml"},
ReuseValues: true,
Timeout: "go sit in the corner",
Chart: "billboard_top_100",
@ -159,6 +156,9 @@ func (suite *PlanTestSuite) TestUpgrade() {
ChartVersion: cfg.ChartVersion,
DryRun: true,
Wait: cfg.Wait,
Values: "steadfastness,forthrightness",
StringValues: "tensile_strength,flexibility",
ValuesFiles: []string{"/root/price_inventory.yml"},
ReuseValues: cfg.ReuseValues,
Timeout: cfg.Timeout,
Force: cfg.Force,
@ -302,6 +302,9 @@ func (suite *PlanTestSuite) TestAddRepos() {
func (suite *PlanTestSuite) TestLint() {
cfg := Config{
Chart: "./flow",
Values: "steadfastness,forthrightness",
StringValues: "tensile_strength,flexibility",
ValuesFiles: []string{"/root/price_inventory.yml"},
LintStrictly: true,
}
@ -310,6 +313,9 @@ func (suite *PlanTestSuite) TestLint() {
want := &run.Lint{
Chart: "./flow",
Values: "steadfastness,forthrightness",
StringValues: "tensile_strength,flexibility",
ValuesFiles: []string{"/root/price_inventory.yml"},
Strict: true,
}
suite.Equal(want, steps[0])

View file

@ -7,9 +7,6 @@ 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

View file

@ -7,6 +7,9 @@ import (
// Lint is an execution step that calls `helm lint` when executed.
type Lint struct {
Chart string
Values string
StringValues string
ValuesFiles []string
Strict bool
cmd cmd
}
@ -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,14 +80,13 @@ func (suite *LintTestSuite) TestPrepareRequiresChart() {
func (suite *LintTestSuite) TestPrepareWithLintFlags() {
defer suite.ctrl.Finish()
cfg := Config{
Values: "width=5",
StringValues: "version=2.0",
ValuesFiles: []string{"/usr/local/underrides", "/usr/local/overrides"},
}
cfg := Config{}
l := Lint{
Chart: "./uk/top_40",
Values: "width=5",
StringValues: "version=2.0",
ValuesFiles: []string{"/usr/local/underrides", "/usr/local/overrides"},
Strict: true,
}

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