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

Setting Helm params with commas now updates local spec #1732

Merged
merged 1 commit into from
Jun 11, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os/exec"
"path"
"reflect"
"regexp"
"strconv"
"strings"
"text/tabwriter"
Expand Down Expand Up @@ -1476,14 +1477,15 @@ func setParameterOverrides(app *argoappv1.Application, parameters []string) {
if app.Spec.Source.Helm == nil {
app.Spec.Source.Helm = &argoappv1.ApplicationSourceHelm{}
}
re := regexp.MustCompile(`([^\\]),`)
for _, paramStr := range parameters {
parts := strings.SplitN(paramStr, "=", 2)
if len(parts) != 2 {
log.Fatalf("Expected helm parameter of the form: param=value. Received: %s", paramStr)
}
newParam := argoappv1.HelmParameter{
Name: parts[0],
Value: parts[1],
Value: re.ReplaceAllString(parts[1], `$1\,`),
}
found := false
for i, cp := range app.Spec.Source.Helm.Parameters {
Expand Down
2 changes: 1 addition & 1 deletion util/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ func (h *helm) GetParameters(valuesFiles []string) ([]*argoappv1.HelmParameter,
}

func (h *helm) helmCmd(args ...string) (string, error) {
cleanHelmParameters(args)
return h.helmCmdExt(args, func(s string) string {
return s
})
}

func (h *helm) helmCmdExt(args []string, logFormat func(string) string) (string, error) {
cleanHelmParameters(args)
cmd := exec.Command("helm", args...)
cmd.Env = os.Environ()
cmd.Dir = h.path
Expand Down