2

我需要将 Argo 输出传递回在另一个工作流模板中生成的工作流

所以我有一个工作流程调用A和两个工作流程模板调用BC

当我运行我的 WorkflowA时,它会调用 WorkflowTemplate B,然后B调用另一个 WorkflowTemplateC

触发流程是这样的A -> B -> c

现在 WorkflowTemplateC将输出作为工件生成。我想将这些输出传递回 WorkflowTemplateB并且应该将它们传递回 Workflow A。这样我就可以将该输出用作同一工作流程中另一个任务的输入A

输出通过流程应该像C -> B -> A

argo 工作流程中有什么方法可以做到这一点吗?你能给我举个例子吗?

4

1 回答 1

1

从另一个 WorkflowTemplatetemplateRef调用模板的工作方式与从同一个 Workflow 调用模板完全相同template

(注意:我写了一篇关于区分 Argo Workflows 中“模板”一词的用法的帖子。)

这是一个改编自工件传递示例的示例

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: templates
spec:
  templates:
  - name: whalesay
    container:
      image: docker/whalesay:latest
      command: [sh, -c]
      args: ["cowsay hello world | tee /tmp/hello_world.txt"]
    outputs:
      artifacts:
      - name: hello-art
        path: /tmp/hello_world.txt
  - name: print-message
    inputs:
      artifacts:
      - name: message
        path: /tmp/message
    container:
      image: alpine:latest
      command: [sh, -c]
      args: ["cat /tmp/message"]
---
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: artifact-passing-
spec:
  entrypoint: artifact-example
  templates:
  - name: artifact-example
    steps:
    - - name: generate-artifact
        templateRef:
          name: templates
          template: whalesay
    - - name: consume-artifact
        templateRef: 
          name: templates
          template: print-message
        arguments:
          artifacts:
          - name: message
            from: "{{steps.generate-artifact.outputs.artifacts.hello-art}}"
于 2022-01-25T14:16:31.300 回答