Skip to content

Commit

Permalink
Merge pull request #1166 from nxf5025/feature/private-helm-repo-add
Browse files Browse the repository at this point in the history
Allow for ExtraArgs in Helm Module for AddRepo
  • Loading branch information
denis256 authored Sep 4, 2022
2 parents 64dd023 + 99c78dd commit ab8a832
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 ab8a832

Please sign in to comment.