Merge branch 'master' into dotenv

This commit is contained in:
Joachim Hill-Grannec 2020-01-02 15:32:40 -05:00 committed by GitHub
commit 222261d931
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

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

View file

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

View file

@ -6,11 +6,8 @@ import (
// Config contains configuration applicable to all helm commands // Config contains configuration applicable to all helm commands
type Config struct { type Config struct {
Debug bool Debug bool
Values string Namespace string
StringValues string Stdout io.Writer
ValuesFiles []string Stderr io.Writer
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. // Lint is an execution step that calls `helm lint` when executed.
type Lint struct { type Lint struct {
Chart string Chart string
Strict bool Values string
cmd cmd StringValues string
ValuesFiles []string
Strict bool
cmd cmd
} }
// Execute executes the `helm lint` command. // Execute executes the `helm lint` command.
@ -33,13 +36,13 @@ func (l *Lint) Prepare(cfg Config) error {
args = append(args, "lint") args = append(args, "lint")
if cfg.Values != "" { if l.Values != "" {
args = append(args, "--set", cfg.Values) args = append(args, "--set", l.Values)
} }
if cfg.StringValues != "" { if l.StringValues != "" {
args = append(args, "--set-string", cfg.StringValues) args = append(args, "--set-string", l.StringValues)
} }
for _, vFile := range cfg.ValuesFiles { for _, vFile := range l.ValuesFiles {
args = append(args, "--values", vFile) args = append(args, "--values", vFile)
} }
if l.Strict { if l.Strict {

View file

@ -80,15 +80,14 @@ func (suite *LintTestSuite) TestPrepareRequiresChart() {
func (suite *LintTestSuite) TestPrepareWithLintFlags() { func (suite *LintTestSuite) TestPrepareWithLintFlags() {
defer suite.ctrl.Finish() defer suite.ctrl.Finish()
cfg := Config{ cfg := Config{}
l := Lint{
Chart: "./uk/top_40",
Values: "width=5", Values: "width=5",
StringValues: "version=2.0", StringValues: "version=2.0",
ValuesFiles: []string{"/usr/local/underrides", "/usr/local/overrides"}, ValuesFiles: []string{"/usr/local/underrides", "/usr/local/overrides"},
} Strict: true,
l := Lint{
Chart: "./uk/top_40",
Strict: true,
} }
command = func(path string, args ...string) cmd { command = func(path string, args ...string) cmd {

View file

@ -12,6 +12,9 @@ type Upgrade struct {
ChartVersion string ChartVersion string
DryRun bool DryRun bool
Wait bool Wait bool
Values string
StringValues string
ValuesFiles []string
ReuseValues bool ReuseValues bool
Timeout string Timeout string
Force bool Force bool
@ -62,13 +65,13 @@ func (u *Upgrade) Prepare(cfg Config) error {
if u.Force { if u.Force {
args = append(args, "--force") args = append(args, "--force")
} }
if cfg.Values != "" { if u.Values != "" {
args = append(args, "--set", cfg.Values) args = append(args, "--set", u.Values)
} }
if cfg.StringValues != "" { if u.StringValues != "" {
args = append(args, "--set-string", cfg.StringValues) args = append(args, "--set-string", u.StringValues)
} }
for _, vFile := range cfg.ValuesFiles { for _, vFile := range u.ValuesFiles {
args = append(args, "--values", vFile) args = append(args, "--values", vFile)
} }

View file

@ -91,20 +91,19 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
u := Upgrade{ u := Upgrade{
Chart: "hot_ac", Chart: "hot_ac",
Release: "maroon_5_memories", Release: "maroon_5_memories",
ChartVersion: "radio_edit", //-version ChartVersion: "radio_edit",
DryRun: true, //-run DryRun: true,
Wait: true, //-wait Wait: true,
ReuseValues: true, //-values
Timeout: "sit_in_the_corner", //-timeout
Force: true, //-force
}
cfg := Config{
Values: "age=35", Values: "age=35",
StringValues: "height=5ft10in", StringValues: "height=5ft10in",
ValuesFiles: []string{"/usr/local/stats", "/usr/local/grades"}, 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 { command = func(path string, args ...string) cmd {
suite.Equal(helmBin, path) suite.Equal(helmBin, path)
suite.Equal([]string{"upgrade", "--install", suite.Equal([]string{"upgrade", "--install",