I have a workflow template which outputs an artifact, this artifact has to be passed to another workflow template as an input. how we can do that? I'm following the way below which is not working
Here is WorflowTemplate1.yaml
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: arfile
spec:
entrypoint: main
templates:
- name: main
volumes:
- name: vol
emptyDir: {}
inputs:
parameters:
script:
image: "ubuntu"
volumeMounts:
- name: vol
mountPath: "{{inputs.parameters.Odir}}"
command: ["bash"]
source: |
#!/usr/bin/env bash
echo "This is artifact testing" > /tmp/arfile
outputs:
parameters:
- name: arfile
path: "{{inputs.parameters.Odir}}/arfile"
Here is the WorkflowTemplate2.yaml
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: bfile
spec:
entrypoint: main
templates:
- name: main
volumes:
- name: vol
emptyDir: {}
inputs:
parameters:
- name: image
value: "ubuntu"
- name: Odir
value: "/tmp"
artifacts:
- name: arfile
path: /tmp/arfile
container:
image: "ubuntu"
command: ["cat"]
args:
- /tmp/arfile
Here is the workflow which is calling the above two workflow templates.I'm unable to pass artifacts of workflowtemplate1 to workflowtemplate2 from this workflow.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: apr-
spec:
entrypoint: main
templates:
- name: main
outputs:
artifacts:
- name: arfile
from: "tasks['dfile'].outputs.artifacts.arfile"
dag:
tasks:
- name: dfile
templateRef:
name: arfile
template: main
arguments:
parameters:
- name: bimg
value: "ubuntu"
- name: bci
depends: dfile
templateRef:
name: bfile
template: main
arguments:
parameters:
- name: img
value: "ubuntu"
artifacts:
- name: arfile
from: "{{tasks.dfile.outputs.artifacts.arfile}}"
What's wrong I'm doing here?
I think I found the issue. I need to use
artifacts
instead ofparameters
inWorkflowTemplate1.yaml
in outputs code blockhere's the fix