如何跳过Argo工作流程的步骤

时间:2019-07-02 02:25:15

标签: kubernetes argoproj

我正在尝试Argo工作流程,并想了解如何冻结步骤。假设我有3个步骤的工作流,而第2步的工作流失败。因此,我想使用成功的第1步的工件重新提交第2步的工作流。我该如何实现?我在文档的任何地方都找不到指导。

1 个答案:

答案 0 :(得分:0)

我认为您应该考虑在步骤中使用ConditionsArtifact passing

  

条件提供了一种方法来影响控制流程   运行时的工作流程,具体取决于参数。在这个例子中   “ print-hello”模板可能会执行,也可能不会执行   在输入参数“应该打印”上。提交时

     

$ argo submit examples/conditionals.yaml

     

由于“应该打印”的评估结果为false,因此将跳过此步骤。   提交时:

     

$ argo submit examples/conditionals.yaml -p should-print=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"]

如果您在每个步骤中都使用条件,则可以从具有适当条件的所需步骤开始。

在本文Argo: Workflow Engine for Kubernetes上也有一个战利品,因为作者解释了coinflip example上条件的使用。 您可以在其GitHub page上看到许多示例。