Skip to content
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 workflow steps cannot be passed as input params to referenced template workflow #13699

Open
3 of 4 tasks
dberardo-com opened this issue Oct 3, 2024 · 2 comments
Labels
area/templating Templating with `{{...}}` type/bug

Comments

@dberardo-com
Copy link

Pre-requisites

  • I have double-checked my configuration
  • I have tested with the :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.
  • I have searched existing issues and could not find a match for this bug
  • I'd like to contribute the fix myself (see contributing guide)

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:

image

image

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.

# inside the master template i am using this step

        - - name: setup-mosquitto
            arguments:
              parameters:
                - name: tenant_name
                  value: '{{workflow.parameters.tenant_name}}'
                - name: tenant_namespace
                  value: >-
                    {{steps.create-namespace.outputs.parameters.tenant_namespace}}


# in the child template i am using simple workflow params:

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-{{workflow.parameters.tenant_name}}
                - name: namespace
                  value: '{{workflow.parameters.tenant_namespace}}'

Logs from the workflow controller

no need

Logs from in your workflow's wait container

no need
@tczhao
Copy link
Member

tczhao commented Oct 3, 2024

Hi @dberardo-com

you have a template main that specifies dag, input...

  • workflow.parameter will refer to the argument field of a running workflow
    e.g.
kind: Workflow
spec:
  arguments:
    parameters:
      - name: foo
        value: bar
  • if you want to refer the main.input in template main's dag task
    you need to refer it as inputs.parameters
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}}'

see example
https://github.com/argoproj/argo-workflows/blob/734b5b6e9f18ebe385df3e41117e67a1e8764939/examples/arguments-parameters.yaml

@dberardo-com
Copy link
Author

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

@agilgur5 agilgur5 added the area/templating Templating with `{{...}}` label Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/templating Templating with `{{...}}` type/bug
Projects
None yet
Development

No branches or pull requests

3 participants