argo-workflows: Cannot access output parameters in non-exit hook

Checklist

  • Double-checked my configuration.
  • Tested using the latest version.
  • Used the Emissary executor.

Summary

When trying to access output parameters in hooks other than exit I get templates.main.steps failed to resolve {{steps.step-1.outputs.parameters.result}}

Argo 3.3.6

Diagnostics

This is the example from https://github.com/argoproj/argo-workflows/blob/df37649251f5791c40802defd923dd735924eb3a/examples/exit-handler-with-param.yaml with exit replaced with foo

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: exit-handler-with-param-
  labels:
    workflows.argoproj.io/test: "true"
  annotations:
    workflows.argoproj.io/description: |
      onExitTemplate enables workflow to pass the arguments (parameters/Artifacts) to exit handler template.
    workflows.argoproj.io/version: '>= 3.1.0'
spec:
  entrypoint: main
  templates:
    - name: main
      steps:
        - - name: step-1
            template: output
            hooks:
              foo:
                template: exit
                arguments:
                  parameters:
                    - name: message
                      value: "{{steps.step-1.outputs.parameters.result}}"
    
    - name: output
      container:
        image: python:alpine3.6
        command: [sh, -c]
        args: ["echo -n hello world > /tmp/hello_world.txt"]
      outputs:
        parameters:
          - name: result
            valueFrom:
              default: "Foobar"   # Default value to use if retrieving valueFrom fails. If not provided workflow will fail instead
              path: /tmp/hello_world.txt
    
    - name: exit
      inputs:
        parameters:
          - name: message
      script:
        image: python:alpine3.6
        command: [ python ]
        source: |
          print("{{inputs.parameters.message}}")

level=info msg="Processing workflow" namespace=default workflow=exit-handler-with-param-jrg25
level=warning msg="Non-transient error: templates.main.steps failed to resolve {{steps.step-1.outputs.parameters.result}}"
level=info msg="Updated phase  -> Failed" namespace=default workflow=exit-handler-with-param-jrg25
level=info msg="Updated message  -> invalid spec: templates.main.steps failed to resolve {{steps.step-1.outputs.parameters.result}}" namespace=default workflow=exit-handler-with-param-jrg25
level=info msg="Marking workflow completed" namespace=default workflow=exit-handler-with-param-jrg25
level=error msg="Unable to set ExecWorkflow" error="templates.main.steps failed to resolve {{steps.step-1.outputs.parameters.result}}" namespace=default workflow=exit-handler-with-param-jrg25
level=info msg="Checking daemoned children of " namespace=default workflow=exit-handler-with-param-jrg25
level=info msg="cleaning up pod" action=deletePod key=default/exit-handler-with-param-jrg25-1340600742-agent/deletePod  

Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 3
  • Comments: 19 (7 by maintainers)

Most upvoted comments

@sarabala1979 Who’s working on this?