Skip to content

Commit

Permalink
fix: helm set parameter to allow passing list parameters (#15978)
Browse files Browse the repository at this point in the history
Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com>
  • Loading branch information
kkk777-7 authored Oct 16, 2023
1 parent 4bf8e7f commit 1a8c593
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 @@ -264,6 +264,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 268 in util/helm/cmd.go

View workflow job for this annotation

GitHub Actions / Build & cache Go code

undefined: strings

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

View workflow job for this annotation

GitHub Actions / Check changes to generated code

undefined: strings
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 1a8c593

Please sign in to comment.