-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
outputs from steps not passed as parameters to templateRef
#13699
Comments
you have a template
kind: Workflow
spec:
arguments:
parameters:
- name: foo
value: bar
spec:
templates:
- name: main
inputs:
parameters:
- name: tenant_name
- name: tenant_namespace
- name: tenant_id
outputs: {}
metadata: {}
dag:
tasks:
- name: ...
template: ...
arguments:
parameters:
- name: tenant_name
value: majico-tree-{{inputs.parameters.tenant_name}}
- name: namespace
value: '{{inputs.parameters.tenant_namespace}}' |
i will look into your answer but i am not sure this is in line with the problem i have. basically the issue is that i am defining both workflow.parameters and outputs in the master template but then i can only read the workflow.parameters in the child template. if seems like the outputs values generated in the master template are not propagated in the children. does it make sense? is there a way to generate an output in the master and read it in the children ? btw when i say children i dont mean tasks or steps, i mean child templates, meaning referenced templates |
templateRef
templateRef
templateRef
You didn't provide a complete example, so it's hard to illustrate, but Tianchu's examples above are correct.
That is what |
ok, after some work i was able to setup a reproducible example to test a bunch of cases and you can see that there are some issues with it: here the parent workflow: metadata:
name: test-parent
spec:
templates:
- name: main
inputs:
parameters:
- name: parent_message
outputs: {}
metadata: {}
steps:
- - name: step1
inline:
inputs: {}
outputs:
parameters:
- name: output_message
valueFrom:
path: /out
metadata: {}
container:
name: main
image: argoproj/argosay:v2
command:
- /bin/sh
- '-c'
args:
- >-
echo {{workflow.parameters.parent_message}} > /out && cat
/out
resources: {}
arguments: {}
- - name: step2
arguments:
parameters:
- name: message
value: '{{workflow.parameters.parent_message}}'
- name: message2
value: '{{steps.step1.outputs.parameters.output_message}}'
- name: message_extra1
value: '{{workflow.parameters.parent_message}}'
- name: message_extra2
value: '{{steps.step1.outputs.parameters.output_message}}'
templateRef:
name: test-sub
template: main
entrypoint: main
arguments:
parameters:
- name: parent_message
value: hi from parent
ttlStrategy:
secondsAfterCompletion: 300
workflowMetadata:
labels:
example: 'true'
here the child metadata:
name: test-sub
spec:
templates:
- name: main
inputs:
parameters:
- name: message
- name: message2
outputs: {}
metadata: {}
steps:
- - name: step1
template: step1
arguments:
parameters:
- name: message
value: '{{workflow.parameters.message}}'
- name: message2
value: '{{workflow.parameters.message2}}'
- name: message3
value: '{{entrypoints.main.inputs.parameters.message}}'
- name: step1
inputs:
parameters:
- name: message
default: empty1
- name: message2
default: empty2
- name: message3
default: empty3
outputs: {}
metadata: {}
container:
name: main
image: argoproj/argosay:v2
command:
- /bin/sh
- '-c'
args:
- >-
echo - {{workflow.parameters.message}} -
{{inputs.parameters.message}} - {{workflow.parameters.message2}} -
{{inputs.parameters.message2}} - {{inputs.parameters.message3}}
resources: {}
entrypoint: main
arguments:
parameters:
- name: message
value: hello argo 1
- name: message2
value: hello argo 2
ttlStrategy:
secondsAfterCompletion: 300
workflowMetadata:
labels:
example: 'true'
so again, my aim is to pass both workflow parameters AND steps output from the parent flow to the child flow |
Thanks for the example. e.g. but when you submit Your options are
For 1. see below example metadata:
name: test-sub
spec:
templates:
- name: main
inputs:
parameters:
- name: message
value: '{{workflow.parameters.message}}'
- name: message2
value: '{{workflow.parameters.message2}}'
outputs: {}
metadata: {}
steps:
- - name: step1
template: step1
arguments:
parameters:
- name: message
value: '{{inputs.parameters.message}}'
- name: message2
value: '{{inputs.parameters.message2}}'
- name: step1
inputs:
parameters:
- name: message
default: empty1
- name: message2
default: empty2
outputs: {}
metadata: {}
container:
name: main
image: argoproj/argosay:v2
command:
- /bin/sh
- '-c'
args:
- >-
echo -
{{inputs.parameters.message}}
{{inputs.parameters.message2}}
resources: {}
entrypoint: main
arguments:
parameters:
- name: message
value: hello argo 1
- name: message2
value: hello argo 2
ttlStrategy:
secondsAfterCompletion: 300
workflowMetadata:
labels:
example: 'true'
|
i think i got it:
i think this is the gist of it! oh dear, this deserves some dedicated piece documentation IMO. |
@AleCeli fyi |
@tczhao @agilgur5 thanks, i did make the needed modifications and indeed it all worked out. i am still wondering however how to handle:
cheers |
We may need a case by case example to understand the exact problem. Overall, I think you could have a look at global parameters https://github.com/argoproj/argo-workflows/blob/main/examples/global-outputs.yaml |
Pre-requisites
:latest
image tag (i.e.quay.io/argoproj/workflow-controller:latest
) and can confirm the issue still exists on:latest
. If not, I have explained why, in detail, in my description below.What happened? What did you expect to happen?
i am using templateRef to call one workflow inside another "master" template.
the master template produces some output in intermediate steps which i would like to pass as parameter to the child workflow.
the params are passed correctly to the templateRef node, but fail to get interpolated in steps below:
Version(s)
v3.5.1
Paste a minimal workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.
Logs from the workflow controller
Logs from in your workflow's wait container
The text was updated successfully, but these errors were encountered: