How to skip a step for Argo workflow

7/2/2019

I'm trying out Argo workflow and would like to understand how to freeze a step. Let's say that I have 3 step workflow and a workflow failed at step 2. So I'd like to resubmit the workflow from step 2 using successful step 1's artifact. How can I achieve this? I couldn't find the guidance anywhere on the document.

-- user3368526
argo-workflows
argoproj
kubernetes

1 Answer

7/2/2019

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

Conditionals provide a way to affect the control flow of a workflow at runtime, depending on parameters. In this example the 'print-hello' template may or may not be executed depending on 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/v1alpha1
kind: Workflow
metadata:
  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.

-- Crou
Source: StackOverflow