聚合国内IT技术精华文章,分享IT技术精华,帮助IT从业人士成长

Conditional checking in Argo workflow

2022-08-19 13:37 浏览: 711703 次 我要评论(0 条) 字号:

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',

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',

Reference



网友评论已有0条评论, 我也要评论

发表评论

*

* (保密)

Ctrl+Enter 快捷回复