l0b0
l0b0

Reputation: 58988

How to conditionally add a list item in Argo?

I have a workflow template with a new spec.arguments.parameters entry which is a string enum with 'true' and 'false' as the possible values. I want to use this to conditionally add an entry to spec.templates.[some-index].container.args. How do I do this? (I don't want to add an empty string to the array; that's going to cause problems down the line.)

Relevant parts of the workflow template YAML:

# yaml-language-server: $schema=https://raw.githubusercontent.com/argoproj/argo-workflows/v3.5.5/api/jsonschema/schema.json
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
spec:
  arguments:
    parameters:
      - name: create_foo
        value: 'true'
        enum:
          - 'false'
          - 'true'
  templates:
    - name: …
      container:
        args:
          # Somehow add `--foo` if workflow.parameters.create_foo == 'true'
          - '--bar'

Upvotes: 2

Views: 148

Answers (0)

Related Questions