Argo workflows conditionals: output 'contains' string?

169 Views Asked by At

I have a 2 step pipeline in argo something where I want the second step to be triggered if the output contains a substring. See this example below:

    - - name: 1-first-step
        template: 1-first-step
        #this one outputs the output_json_list: "[{"A:"Joe", "B":"Bob"}]"

    - - name: 2-second-step
        templateRef:
          name:  2-second-step
          template: main
        arguments:
          parameters:
            - name: Some_name
              value: "Some_value"
        when: "{{contains 1-first-step.outputs.parameters.output_json_list 'Joe'}}" #how do I write this?
1

There are 1 best solutions below

0
On

Figured it out. You can just regex match the condition as the json list will always be a string:

when: "{{1-first-step.outputs.parameters.output_json_list}} =~ '.*Joe.*'"

reference