繁体   English   中英

如何访问在 argo 的另一个工作流模板中生成的工作流中的输出

[英]How to access the outputs in a workflow which are generated in another workflow template in argo

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

所以我有一个名为A工作流程和两个名为BC的工作流程模板

当我运行我的 Workflow A时,它调用 WorkflowTemplate B ,然后B调用另一个 WorkflowTemplate C

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

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

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

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

通过 templateRef 从另一个 WorkflowTemplate 调用模板与通过templateRef从同一个 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}}"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM