How to skip a step for Argo workflow How to skip a step for Argo workflow kubernetes kubernetes

How to skip a step for Argo workflow


I think you should consider using Conditions and Artifact passing in your steps.

Conditionals provide a way to affect the control flow of aworkflow at runtime, depending on parameters. In this examplethe 'print-hello' template may or may not be executed dependingon the input parameter, 'should-print'. When submitted with

$ argo submit examples/conditionals.yaml

the step will be skipped since 'should-print' will evaluate false.When submitted with:

$ argo submit examples/conditionals.yaml -p should-print=true

the step will be executed since 'should-print' will evaluate true.

apiVersion: argoproj.io/v1alpha1kind: Workflowmetadata:  generateName: conditional-spec:  entrypoint: conditional-example  arguments:    parameters:    - name: should-print      value: "false"  templates:  - name: conditional-example    inputs:      parameters:      - name: should-print    steps:    - - name: print-hello        template: whalesay        when: "{{inputs.parameters.should-print}} == true"  - name: whalesay    container:      image: docker/whalesay:latest      command: [sh, -c]      args: ["cowsay hello"]

If you use conditions in each step you will be able to start from a step you like with appropriate condition.

Also have a loot at this article Argo: Workflow Engine for Kubernetes as author explains the use of conditions on coinflip example.You can see many examples on their GitHub page.