Skip to content

Commit

Permalink
Allowing extraArgs for helm repo add
Browse files Browse the repository at this point in the history
  • Loading branch information
nxf5025 committed Aug 10, 2022
1 parent 3e7eac6 commit 99c78dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/helm/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ type Options struct {
EnvVars map[string]string // Environment variables to set when running helm
Version string // Version of chart
Logger *logger.Logger // Set a non-default logger that should be used. See the logger package for more info. Use logger.Discard to not print the output while executing the command.
ExtraArgs map[string][]string // Extra arguments to pass to the helm install/upgrade/rollback/delete command. The key signals the command (e.g., install) while the values are the extra arguments to pass through.
ExtraArgs map[string][]string // Extra arguments to pass to the helm install/upgrade/rollback/delete and helm repo add commands. The key signals the command (e.g., install) while the values are the extra arguments to pass through.
}
11 changes: 10 additions & 1 deletion modules/helm/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ func AddRepo(t testing.TestingT, options *Options, repoName string, repoURL stri

// AddRepoE will setup the provided helm repository to the local helm client configuration.
func AddRepoE(t testing.TestingT, options *Options, repoName string, repoURL string) error {
_, err := RunHelmCommandAndGetOutputE(t, options, "repo", "add", repoName, repoURL)
// Set required args
args := []string{"add", repoName, repoURL}

// Append helm repo add ExtraArgs if available
if options.ExtraArgs != nil {
if repoAddArgs, ok := options.ExtraArgs["repoAdd"]; ok {
args = append(args, repoAddArgs...)
}
}
_, err := RunHelmCommandAndGetOutputE(t, options, "repo", args...)
return err
}

Expand Down

0 comments on commit 99c78dd

Please sign in to comment.