Merge branch 'master' into godiomaticity
This commit is contained in:
@@ -9,8 +9,9 @@ import (
|
||||
// AddRepo is an execution step that calls `helm repo add` when executed.
|
||||
type AddRepo struct {
|
||||
*config
|
||||
repo string
|
||||
cmd cmd
|
||||
repo string
|
||||
caFile string
|
||||
cmd cmd
|
||||
}
|
||||
|
||||
// NewAddRepo creates an AddRepo for the given repo-spec. No validation is performed at this time.
|
||||
@@ -18,6 +19,7 @@ func NewAddRepo(cfg env.Config, repo string) *AddRepo {
|
||||
return &AddRepo{
|
||||
config: newConfig(cfg),
|
||||
repo: repo,
|
||||
caFile: cfg.RepoCAFile,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +42,11 @@ func (a *AddRepo) Prepare() error {
|
||||
url := split[1]
|
||||
|
||||
args := a.globalFlags()
|
||||
args = append(args, "repo", "add", name, url)
|
||||
args = append(args, "repo", "add")
|
||||
if a.caFile != "" {
|
||||
args = append(args, "--ca-file", a.caFile)
|
||||
}
|
||||
args = append(args, name, url)
|
||||
|
||||
a.cmd = command(helmBin, args...)
|
||||
a.cmd.Stdout(a.stdout)
|
||||
|
||||
@@ -96,3 +96,15 @@ func (suite *AddRepoTestSuite) TestPrepareWithEqualSignInURL() {
|
||||
suite.NoError(a.Prepare())
|
||||
suite.Contains(suite.commandArgs, "https://github.com/arthur_claypool/samaritan?version=2.1")
|
||||
}
|
||||
|
||||
func (suite *AddRepoTestSuite) TestRepoAddFlags() {
|
||||
suite.mockCmd.EXPECT().Stdout(gomock.Any()).AnyTimes()
|
||||
suite.mockCmd.EXPECT().Stderr(gomock.Any()).AnyTimes()
|
||||
cfg := env.Config{
|
||||
RepoCAFile: "./helm/reporepo.cert",
|
||||
}
|
||||
a := NewAddRepo(cfg, "machine=https://github.com/harold_finch/themachine")
|
||||
suite.NoError(a.Prepare())
|
||||
suite.Equal([]string{"repo", "add", "--ca-file", "./helm/reporepo.cert",
|
||||
"machine", "https://github.com/harold_finch/themachine"}, suite.commandArgs)
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ type Upgrade struct {
|
||||
force bool
|
||||
atomic bool
|
||||
cleanupOnFail bool
|
||||
caFile string
|
||||
|
||||
cmd cmd
|
||||
}
|
||||
@@ -43,6 +44,7 @@ func NewUpgrade(cfg env.Config) *Upgrade {
|
||||
force: cfg.Force,
|
||||
atomic: cfg.AtomicUpgrade,
|
||||
cleanupOnFail: cfg.CleanupOnFail,
|
||||
caFile: cfg.RepoCAFile,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +98,9 @@ func (u *Upgrade) Prepare() error {
|
||||
for _, vFile := range u.valuesFiles {
|
||||
args = append(args, "--values", vFile)
|
||||
}
|
||||
if u.caFile != "" {
|
||||
args = append(args, "--ca-file", u.caFile)
|
||||
}
|
||||
|
||||
args = append(args, u.release, u.chart)
|
||||
u.cmd = command(helmBin, args...)
|
||||
|
||||
@@ -136,6 +136,7 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
|
||||
Force: true,
|
||||
AtomicUpgrade: true,
|
||||
CleanupOnFail: true,
|
||||
RepoCAFile: "local_ca.cert",
|
||||
}
|
||||
u := NewUpgrade(cfg)
|
||||
|
||||
@@ -154,6 +155,7 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
|
||||
"--set-string", "height=5ft10in",
|
||||
"--values", "/usr/local/stats",
|
||||
"--values", "/usr/local/grades",
|
||||
"--ca-file", "local_ca.cert",
|
||||
"maroon_5_memories", "hot_ac"}, args)
|
||||
|
||||
return suite.mockCmd
|
||||
|
||||
Reference in New Issue
Block a user