Conditional checking in Argo workflow
source link: https://donghao.org/2022/08/19/conditional-checking-in-argo-workflow/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Conditional checking in Argo workflow
My company has been using Argo for executing workflow for more than three years. I knew every step in the Argo workflow could be controlled by when
expression, like this:
apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: example- spec: entrypoint: first-step arguments: - parameters: - - name: 'COLOR', value: std.extVar('COLOR'), templates: - name: first-stage steps: # flip a coin - - name: first-step template: step-first when: '{{workflow.parameters.COLOR}} == red',
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: example-
spec:
entrypoint: first-step
arguments:
- parameters:
- - name: 'COLOR',
value: std.extVar('COLOR'),
templates:
- name: first-stage
steps:
# flip a coin
- - name: first-step
template: step-first
when: '{{workflow.parameters.COLOR}} == red',
What if I want to check more than one condition? Just use “&&” as “and”, “||” as “or”:
... - name: first-stage steps: # flip a coin - - name: first-step template: step-first when: '{{workflow.parameters.COLOR}} == red || {{workflow.parameters.COLOR}} == blue',
...
- name: first-stage
steps:
# flip a coin
- - name: first-step
template: step-first
when: '{{workflow.parameters.COLOR}} == red || {{workflow.parameters.COLOR}} == blue',
Related Posts
- Submit Argo workflow to different clusters
A couple of days ago I am looking for a tool to manage different Kubernetes…
- A problem about running Argo
After I launched an Argo workflow, it just hanged on ContainerCreating stage. After waiting for…
- Failed to establish pod watch in Argo
After creating a brand new Kubernetes cluster in GKE, I launched an Argo workflow but…
August 19, 2022 - 3:54
RobinDong
develop
Argo
Leave a comment
Leave a Reply Cancel reply
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK