Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for ExtraArgs in Helm Module for AddRepo #1166

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/helm/options.go
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
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