yamlargo-workflows

Pass a parameter as list to argo workflow


I have the following JSON file which will be passed as a parameter file to an Argo workflow:

{
  "keys": [
    "key1",
    "key2",
    "key3"
  ]
}

Accessing "keys" like '{{inputs.parameters.keys}}' reads keys as a string instead of a list.

Is it possible to read an input parameter from a parameter file as a list of values?


Solution

  • Within an Argo Workflow, parameters are always strings.

    You can use expression templates to retrieve information from the stringified list.

    value: '{{=jsonpath(inputs.parameters.keys, "$.0")}}' # get the first item