How to pass arry to container.args? #15460
Replies: 1 comment
|
Structurally impossible through args templating and that is by design not a missing feature Argo substitutes every tag into the already serialized JSON of your template replacementStr = strconv.Quote(replacementStr)
replacementStr = replacementStr[1:len(replacementStr)-1]so whatever you put inside The supported way is podSpecPatch: '{"containers":[{"name":"main","args":{{inputs.parameters.args}}}]}'with the parameter holding
If podSpecPatch is locked down in your setup the fallback is folding the whole thing into one shell string command: [sh, -c]
args: ["{{inputs.parameters.args_as_shell_string}}"] |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have a input string that i've constructed in another step that I need to use as a .container.args. How do I template that? I've tried a few things so far.
Input parameter: '["--foo","--bar","--baz"]'
Template
things that do not work:
"{{inputs.parameters.args}}"(this passes the whole json array as one list item)"{{=sprig.fromJson(input.parameters.args}}"(json: cannot unmarshal string into Go struct field Container.spec.templates.container.args of type []string)args: [ "{{inputs.parameters.message}}" ]but that only works if you have a single parameter or a fixed number of parameters.All reactions