Closed ABWassim closed 1 year ago
You are right. helm-secrets is always splitting on ,
, except on \,
. I was not aware of this syntax.
The problem also exists with
helm secrets template --set-json='locales=["fr","de","en","ko","zh"]' .
I would be happy to open a PR, but I would need your validation first on what I said above :)
I would happy about an PR it would helps a lot. Please include some test that guaranteed that some edge cases are cover.
Here test-cases like
helm template --set 'locales={fr,d\,e,en,ko,zh},a=b' .
helm template --set 'locales={fr,de,\}3\,2,ko,zh}' .
helm template --set 'locales={fr,d\,e,en,ko,zh},a=b,c=Hello{Wo\,a' .
helm template --set-json='locales=["fr","de","en","ko","zh"],a={"Hello": "world"}' . # optional
Also please net me know, if its too hard. I mean this is silly POSIX shell and it can be quite complex.
Current Behavior
Hello :)
In my CI, I need to pass a array value using the
--set
option ofhelm secrets template
. I do it using the commandhelm secrets template --set locales={fr,de,en,ko,zh} .
. I later use this value and iterate over it in my resources, which we could simplify to this Helm code :I would expect Helm to output something like this :
But instead, what i get from
helm secrets template --set locales={fr,de,en,ko,zh} .
is :When using the
--debug
option, I saw that the final Helm command was :helm template . --set 'locales={fr,de=de,en=en,ko=ko,zh}=zh}'
After looking at the code, I think it comes from this file, line 87 :
When iterating over
literals
(line 72),literal
will be equal tode
in the second iteration. (second value of the array)opt_prefix
will then be equal tode=
when it should be equal to empty string from my understanding.It doesn't happen first iteration because
literal
will be equal tolocales={fr
, and here we can actually split by=
.I would be happy to open a PR, but I would need your validation first on what I said above :)
Thank you, Wassim.
Expected Behavior
I would expect
helm secrets template
to parse the value correctly as described above.Steps To Reproduce
Environment
Anything else?
--debug
logs :