Skip to content

Commit

Permalink
fix: helm set parameter to allow passing list parameters (#15978) (#1…
Browse files Browse the repository at this point in the history
…5994)

Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com>
Co-authored-by: Kota Kimura <86363983+kkk777-7@users.noreply.github.com>
  • Loading branch information
gcp-cherry-pick-bot[bot] and kkk777-7 authored Oct 16, 2023
1 parent 0a40430 commit a9c87d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions util/helm/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ var (
)

func cleanSetParameters(val string) string {
// `{}` equal helm list parameters format, so don't escape `,`.
if strings.HasPrefix(val, `{`) && strings.HasSuffix(val, `}`) {

Check failure on line 275 in util/helm/cmd.go

View workflow job for this annotation

GitHub Actions / Build & cache Go code

undefined: strings

Check failure on line 275 in util/helm/cmd.go

View workflow job for this annotation

GitHub Actions / Check changes to generated code

undefined: strings

Check failure on line 275 in util/helm/cmd.go

View workflow job for this annotation

GitHub Actions / Lint Go code

undefined: strings) (typecheck)

Check failure on line 275 in util/helm/cmd.go

View workflow job for this annotation

GitHub Actions / Lint Go code

undefined: strings) (typecheck)
return val
}
return re.ReplaceAllString(val, `$1\,`)
}

Expand Down
1 change: 1 addition & 0 deletions util/helm/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ func TestHelmArgCleaner(t *testing.T) {
`bar`: `bar`,
`not, clean`: `not\, clean`,
`a\,b,c`: `a\,b\,c`,
`{a,b,c}`: `{a,b,c}`,
} {
cleaned := cleanSetParameters(input)
assert.Equal(t, expected, cleaned)
Expand Down

0 comments on commit a9c87d2

Please sign in to comment.