简体   繁体   中英

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

I've a requirement to pass the Argo outputs back to workflow which are generated in a another workflow template

So I have ONE Workflow called A and TWO WorkflowTemplates called B and C

When I run my Workflow A it invokes WorkflowTemplate B and then B invokes another WorkflowTemplate C

The trigger flow is like this A -> B -> c

Now the WorkflowTemplate C produces the outputs as an artifact. I want to pass these outputs back to WorkflowTemplate B and the same should be passed back to Workflow A . So that I can use that output as an input to another task in the same Workflow A

The outputs passing flow should be like C -> B -> A

Is there any way in argo workflows to do this? Can you point me to an example?

Invoking a template from another WorkflowTemplate via templateRef works precisely the same as invoking a template from the same Workflow via template .

(Note: I wrote a post on differentiating uses of the word "template" in Argo Workflows .)

Here's an example adapted from the artifact passing example :

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}}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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