Repository navigation
Conversation
handleHelmUpgradeRelease split the set parameter on every comma, so a
list value such as tolerations={a,b} or an escaped comma (a\,b) was cut
into two --set flags and helm failed with "list must terminate with '}'"
or "key has no value". Split only on commas outside braces and not
escaped with a backslash, the same places helm's own parser splits.
Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
helm_upgradetakessetaskey1=val1,key2=val2and turns it into one--setper item withstrings.Split(in.Set, ","). That also cuts the commas helm itself treats as part of a value, so two documented--setforms could not be passed through the tool:splitSetValuesnow splits only on commas that are outside{...}and not escaped with\, trims each item and drops empty ones. Plainkey1=val1,key2=val2input produces the same arguments as before, so the existing "upgrade with all options" test is unchanged.Tests: a
helm_upgradecase withargs={--verbose,--debug}, annotation=a\,b, replicas=2that expects three--setflags (fails onmain, where the list is split intoargs={--verboseand--debug}), and a table test forsplitSetValuescovering spaces, nested lists, escapes and empty items.go test -tags=test ./pkg/... ./internal/... ./cmd/...,go vetandgolangci-lint run --build-tags=test ./pkg/helm/pass.AI disclosure: written with the help of Claude Code, reviewed and tested by me.