7

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.

crenshaw-dev
  • 7,504
  • 3
  • 45
  • 81
user3368526
  • 2,168
  • 10
  • 37
  • 52

1 Answers1

4

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.

crenshaw-dev
  • 7,504
  • 3
  • 45
  • 81
Crou
  • 10,232
  • 2
  • 26
  • 31
  • Thanks for the comment :) I know conditionals but would it be possible to use artifacts created from a different run (such as artifact from a previously failed one)? – user3368526 Jul 03 '19 at 10:33
  • You mean using a failed workflow artifact inside new workflow? – Crou Jul 03 '19 at 10:37
  • It'd like to take the failed workflow and use a different image to restart from the specific step that failed. So that I don't have to run previous steps that were successful over and over again. – user3368526 Jul 03 '19 at 10:50
  • 1
    I don't know, but I don't think this should be possible. The workflow failed and it should not be possible to use artifacts from that workflow in a new workflow especially when the image changes. – Crou Jul 03 '19 at 11:58