Add a setting for chart repository CA certificates [#74]
This commit is contained in:
@@ -7,8 +7,9 @@ import (
|
||||
|
||||
// AddRepo is an execution step that calls `helm repo add` when executed.
|
||||
type AddRepo struct {
|
||||
Repo string
|
||||
cmd cmd
|
||||
Repo string
|
||||
CAFile string
|
||||
cmd cmd
|
||||
}
|
||||
|
||||
// Execute executes the `helm repo add` command.
|
||||
@@ -38,7 +39,11 @@ func (a *AddRepo) Prepare(cfg Config) error {
|
||||
args = append(args, "--debug")
|
||||
}
|
||||
|
||||
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(cfg.Stdout)
|
||||
|
||||
@@ -97,6 +97,19 @@ func (suite *AddRepoTestSuite) TestPrepareWithEqualSignInURL() {
|
||||
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 := Config{}
|
||||
a := AddRepo{
|
||||
Repo: "machine=https://github.com/harold_finch/themachine",
|
||||
CAFile: "./helm/reporepo.cert",
|
||||
}
|
||||
suite.NoError(a.Prepare(cfg))
|
||||
suite.Equal([]string{"repo", "add", "--ca-file", "./helm/reporepo.cert",
|
||||
"machine", "https://github.com/harold_finch/themachine"}, suite.commandArgs)
|
||||
}
|
||||
|
||||
func (suite *AddRepoTestSuite) TestNamespaceFlag() {
|
||||
suite.mockCmd.EXPECT().Stdout(gomock.Any()).AnyTimes()
|
||||
suite.mockCmd.EXPECT().Stderr(gomock.Any()).AnyTimes()
|
||||
|
||||
Reference in New Issue
Block a user