Skip to content

how to use jsonpath in when condition #7413

Closed Answered by crenshaw-dev
liuzqt asked this question in Q&A
Discussion options

You must be logged in to vote

Just abuse a bug to make it work.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  name: my-pipeline
spec:
  entrypoint: main
  arguments:
    parameters:
      - name: myjson
        value: '{"key1": 100}'
  templates:
    - name: main
      dag:
        tasks:
          - name: dummy
            when: "1 < {{=jsonpath(workflow.parameters.myjson, '$.key1')}}"
            inline:
              container:
                image: docker/whalesay:latest
                command: [sh, -c]
                args: ["echo {{workflow.parameters.myjson}}"]
 $ argo submit -n argo test.yaml --log
Name:                my-pipeline
Namespace:           argo
ServiceAccount:      default
Status:  …

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
4 replies
@liuzqt
Comment options

@thegreymatter
Comment options

@liuzqt
Comment options

@agilgur5
Comment options

This comment has been minimized.

Comment options

You must be logged in to vote
3 replies
@liuzqt
Comment options

@alexec
Comment options

@liuzqt
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by agilgur5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
solution/workaround There's a workaround, might not be great, but exists area/templating Templating with `{{...}}`
6 participants