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

Can't use retryStrategy AND hooks on a step that outputs an artifact with downstream consumers #12109

Closed
2 of 3 tasks
mbertelsen-kryptowire opened this issue Oct 30, 2023 · 5 comments · Fixed by #12815
Closed
2 of 3 tasks
Assignees
Labels
area/hooks area/retryStrategy Template-level retryStrategy area/templating Templating with `{{...}}` P2 Important. All bugs with >=3 thumbs up that aren’t P0 or P1, plus: Any other bugs deemed important type/bug

Comments

@mbertelsen-kryptowire
Copy link

Pre-requisites

  • I have double-checked my configuration
  • I can confirm the issues exists when I tested with :latest
  • I'd like to contribute the fix myself (see contributing guide)

What happened/what you expected to happen?

I would expect for me to be able to use both hooks and retries on the same step. When I use one or the other, it works. But together, it messes up the resolution of artifacts for my downstream consumers. The error shows on the workflow as unable to resolve references: Unable to resolve: "steps.build.outputs.artifacts.result". Additionally, the build step shows as Running but all the pods have completed or errored.

Version

v3.5.0

Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: retries-with-hooks-and-artifact
  labels:
    workflows.argoproj.io/test: "true"
  annotations:
    workflows.argoproj.io/description: |
      when retries and hooks are both included, the workflow cannot resolve the artifact 
    workflows.argoproj.io/version: '>= 3.5.0'
spec:
  entrypoint: main
  templates:
    - name: main
      steps:
        - - name: build
            template: output-artifact
            hooks:
              started:
                expression: steps["build"].status == "Running"
                template: started
              success:
                expression: steps["build"].status == "Succeeded"
                template: success
              failed:
                expression: steps["build"].status == "Failed" || steps["build"].status == "Error"
                template: failed
        - - name: print
            template: print-artifact
            arguments:
              artifacts:
                - name: message
                  from: "{{steps.build.outputs.artifacts.result}}"
    
    - name: output-artifact
      script:
        image: python:alpine3.6
        command: [ python ]
        source: |
          import time
          import random
          time.sleep(random.randint(20,40)) # lifecycle hook for running won't trigger unless it runs for more than "a few seconds"
          with open("result.txt", "w") as f:
            f.write("Welcome")
          # sys.exit("fail!")
      timeout: 30s
      retryStrategy: 
        limit: 3
      outputs:
        artifacts:
          - name: result
            path: /result.txt

    - name: started
      container:
        image: python:alpine3.6
        command: [sh, -c]
        args: ["echo STARTED!"]

    - name: success
      container:
        image: python:alpine3.6
        command: [sh, -c]
        args: ["echo SUCCEEDED!"]

    - name: failed
      container:
        image: python:alpine3.6
        command: [sh, -c]
        args: ["echo FAILED or ERROR!"]

    - name: print-artifact
      inputs:
        artifacts:
          - name: message
            path: /tmp/message
      container:
        image: python:alpine3.6
        command: [sh, -c]
        args: ["cat /tmp/message"]

Logs from the workflow controller

time="2023-10-30T21:00:05.483Z" level=info msg="Processing workflow" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.489Z" level=info msg="Updated phase  -> Running" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.489Z" level=warning msg="Node was nil, will be initialized as type Skipped" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.489Z" level=info msg="was unable to obtain node for , letting display name to be nodeName" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.489Z" level=info msg="Steps node retries-with-hooks-and-artifactm8mr9 initialized Running" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.489Z" level=info msg="StepGroup node retries-with-hooks-and-artifactm8mr9-1288286827 initialized Running" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.489Z" level=warning msg="Node was nil, will be initialized as type Skipped" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.489Z" level=info msg="Retry node retries-with-hooks-and-artifactm8mr9-1973829493 initialized Running" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.489Z" level=info msg="Pod node retries-with-hooks-and-artifactm8mr9-2959657300 initialized Pending" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.505Z" level=info msg="Created pod: retries-with-hooks-and-artifactm8mr9[0].build(0) (retries-with-hooks-and-artifactm8mr9-output-artifact-2959657300)" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.506Z" level=info msg="Running hooks" hookName=started lifeCycleHook=started namespace=appanalysis-dev node="retries-with-hooks-and-artifactm8mr9[0].build.hooks.started" workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.506Z" level=warning msg="Node was nil, will be initialized as type Skipped" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.506Z" level=info msg="Pod node retries-with-hooks-and-artifactm8mr9-2383126216 initialized Pending" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.519Z" level=info msg="Created pod: retries-with-hooks-and-artifactm8mr9[0].build.hooks.started (retries-with-hooks-and-artifactm8mr9-started-2383126216)" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.519Z" level=info msg="Workflow step group node retries-with-hooks-and-artifactm8mr9-1288286827 not yet completed" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.519Z" level=info msg="TaskSet Reconciliation" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.519Z" level=info msg=reconcileAgentPod namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:05.527Z" level=info msg="Workflow update successful" namespace=appanalysis-dev phase=Running resourceVersion=69916791 workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.507Z" level=info msg="Processing workflow" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.507Z" level=info msg="Task-result reconciliation" namespace=appanalysis-dev numObjs=0 workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.507Z" level=info msg="node changed" namespace=appanalysis-dev new.message= new.phase=Succeeded new.progress=0/1 nodeID=retries-with-hooks-and-artifactm8mr9-2383126216 old.message= old.phase=Pending old.progress=0/1 workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.508Z" level=info msg="node changed" namespace=appanalysis-dev new.message= new.phase=Running new.progress=0/1 nodeID=retries-with-hooks-and-artifactm8mr9-2959657300 old.message= old.phase=Pending old.progress=0/1 workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.508Z" level=info msg="node retries-with-hooks-and-artifactm8mr9-1973829493 phase Running -> Succeeded" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.508Z" level=info msg="node retries-with-hooks-and-artifactm8mr9-1973829493 finished: 2023-10-30 21:00:15.508423924 +0000 UTC" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.508Z" level=info msg="Running hooks" hookName=started lifeCycleHook=started namespace=appanalysis-dev node="retries-with-hooks-and-artifactm8mr9[0].build.hooks.started" workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.508Z" level=info msg="Running hooks" hookName=success lifeCycleHook=success namespace=appanalysis-dev node="retries-with-hooks-and-artifactm8mr9[0].build.hooks.success" workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.508Z" level=warning msg="Node was nil, will be initialized as type Skipped" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.508Z" level=info msg="Pod node retries-with-hooks-and-artifactm8mr9-2102555102 initialized Pending" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.524Z" level=info msg="Created pod: retries-with-hooks-and-artifactm8mr9[0].build.hooks.success (retries-with-hooks-and-artifactm8mr9-success-2102555102)" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.524Z" level=info msg="Workflow step group node retries-with-hooks-and-artifactm8mr9-1288286827 not yet completed" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.524Z" level=info msg="TaskSet Reconciliation" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.524Z" level=info msg=reconcileAgentPod namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.533Z" level=info msg="Workflow update successful" namespace=appanalysis-dev phase=Running resourceVersion=69916945 workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:15.539Z" level=info msg="cleaning up pod" action=labelPodCompleted key=appanalysis-dev/retries-with-hooks-and-artifactm8mr9-started-2383126216/labelPodCompleted
time="2023-10-30T21:00:25.523Z" level=info msg="Processing workflow" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.523Z" level=info msg="Task-result reconciliation" namespace=appanalysis-dev numObjs=0 workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.523Z" level=info msg="node changed" namespace=appanalysis-dev new.message= new.phase=Succeeded new.progress=0/1 nodeID=retries-with-hooks-and-artifactm8mr9-2102555102 old.message= old.phase=Pending old.progress=0/1 workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.523Z" level=info msg="node unchanged" namespace=appanalysis-dev nodeID=retries-with-hooks-and-artifactm8mr9-2959657300 workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="Running hooks" hookName=started lifeCycleHook=started namespace=appanalysis-dev node="retries-with-hooks-and-artifactm8mr9[0].build.hooks.started" workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="Running hooks" hookName=success lifeCycleHook=success namespace=appanalysis-dev node="retries-with-hooks-and-artifactm8mr9[0].build.hooks.success" workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="Step group node retries-with-hooks-and-artifactm8mr9-1288286827 successful" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="node retries-with-hooks-and-artifactm8mr9-1288286827 phase Running -> Succeeded" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="node retries-with-hooks-and-artifactm8mr9-1288286827 finished: 2023-10-30 21:00:25.524383375 +0000 UTC" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="StepGroup node retries-with-hooks-and-artifactm8mr9-2429312014 initialized Running" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="SG Outbound nodes of retries-with-hooks-and-artifactm8mr9-1973829493 are [retries-with-hooks-and-artifactm8mr9-2102555102]" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=error msg="Mark error node" error="unable to resolve references: Unable to resolve: \"steps.build.outputs.artifacts.result\"" namespace=appanalysis-dev nodeName="retries-with-hooks-and-artifactm8mr9[1]" workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="node retries-with-hooks-and-artifactm8mr9-2429312014 phase Running -> Error" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="node retries-with-hooks-and-artifactm8mr9-2429312014 message: unable to resolve references: Unable to resolve: \"steps.build.outputs.artifacts.result\"" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="node retries-with-hooks-and-artifactm8mr9-2429312014 finished: 2023-10-30 21:00:25.524554118 +0000 UTC" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="step group retries-with-hooks-and-artifactm8mr9-2429312014 was unsuccessful: unable to resolve references: Unable to resolve: \"steps.build.outputs.artifacts.result\"" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="Outbound nodes of retries-with-hooks-and-artifactm8mr9 is []" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="node retries-with-hooks-and-artifactm8mr9 phase Running -> Failed" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="node retries-with-hooks-and-artifactm8mr9 message: unable to resolve references: Unable to resolve: \"steps.build.outputs.artifacts.result\"" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="node retries-with-hooks-and-artifactm8mr9 finished: 2023-10-30 21:00:25.524615435 +0000 UTC" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="TaskSet Reconciliation" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg=reconcileAgentPod namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="Updated phase Running -> Failed" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="Updated message  -> unable to resolve references: Unable to resolve: \"steps.build.outputs.artifacts.result\"" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.524Z" level=info msg="Marking workflow completed" namespace=appanalysis-dev workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.530Z" level=info msg="cleaning up pod" action=deletePod key=appanalysis-dev/retries-with-hooks-and-artifactm8mr9-1340600742-agent/deletePod
time="2023-10-30T21:00:25.537Z" level=info msg="Workflow update successful" namespace=appanalysis-dev phase=Failed resourceVersion=69917068 workflow=retries-with-hooks-and-artifactm8mr9
time="2023-10-30T21:00:25.549Z" level=info msg="cleaning up pod" action=labelPodCompleted key=appanalysis-dev/retries-with-hooks-and-artifactm8mr9-success-2102555102/labelPodCompleted

Logs from in your workflow's wait container

time="2023-10-30T21:00:35.493Z" level=info msg="No Script output reference in workflow. Capturing script output ignored"
time="2023-10-30T21:00:35.493Z" level=info msg="No output parameters"
time="2023-10-30T21:00:35.493Z" level=info msg="Saving output artifacts"
time="2023-10-30T21:00:35.493Z" level=info msg="Staging artifact: result"
time="2023-10-30T21:00:35.493Z" level=info msg="Copying /result.txt from container base image layer to /tmp/argo/outputs/artifacts/result.tgz"
time="2023-10-30T21:00:35.493Z" level=info msg="/var/run/argo/outputs/artifacts/result.txt.tgz -> /tmp/argo/outputs/artifacts/result.tgz"
time="2023-10-30T21:00:35.493Z" level=error msg="executor error: open /var/run/argo/outputs/artifacts/result.txt.tgz: no such file or directory"
time="2023-10-30T21:00:35.537Z" level=warning msg="failed to patch task set, falling back to legacy/insecure pod patch, see https://argoproj.github.io/argo-workflows/workflow-rbac/" error="workflowtaskresults.argoproj.io is forbidden: User \"system:serviceaccount:appanalysis-dev:argo-submitter\" cannot create resource \"workflowtaskresults\" in API group \"argoproj.io\" in the namespace \"appanalysis-dev\""
time="2023-10-30T21:00:35.556Z" level=info msg="Alloc=9439 TotalAlloc=13839 Sys=23653 NumGC=3 Goroutines=5"
time="2023-10-30T21:00:35.556Z" level=fatal msg="open /var/run/argo/outputs/artifacts/result.txt.tgz: no such file or directory"
time="2023-10-30T21:00:09.475Z" level=info msg="Starting Workflow Executor" version=v3.5.0
time="2023-10-30T21:00:09.477Z" level=info msg="Using executor retry strategy" Duration=1s Factor=1.6 Jitter=0.5 Steps=5
time="2023-10-30T21:00:09.477Z" level=info msg="Executor initialized" deadline="0001-01-01 00:00:00 +0000 UTC" includeScriptOutput=false namespace=appanalysis-dev podName=retries-with-hooks-and-artifactm8mr9-started-2383126216 template="{\"name\":\"started\",\"inputs\":{},\"outputs\":{},\"metadata\":{},\"container\":{\"name\":\"\",\"image\":\"python:alpine3.6\",\"command\":[\"sh\",\"-c\"],\"args\":[\"echo STARTED!\"],\"resources\":{}}}" version="&Version{Version:v3.5.0,BuildDate:2023-10-13T13:06:32Z,GitCommit:bf735a2e861d6b1c686dd4a076afc3468aa89c4a,GitTag:v3.5.0,GitTreeState:clean,GoVersion:go1.21.3,Compiler:gc,Platform:linux/amd64,}"
time="2023-10-30T21:00:09.478Z" level=info msg="Starting deadline monitor"
time="2023-10-30T21:00:11.478Z" level=info msg="Main container completed" error="<nil>"
time="2023-10-30T21:00:11.478Z" level=info msg="No Script output reference in workflow. Capturing script output ignored"
time="2023-10-30T21:00:11.478Z" level=info msg="No output parameters"
time="2023-10-30T21:00:11.478Z" level=info msg="No output artifacts"
time="2023-10-30T21:00:11.478Z" level=info msg="Alloc=8708 TotalAlloc=12828 Sys=19301 NumGC=3 Goroutines=7"
time="2023-10-30T21:00:17.486Z" level=info msg="Starting Workflow Executor" version=v3.5.0
time="2023-10-30T21:00:17.488Z" level=info msg="Using executor retry strategy" Duration=1s Factor=1.6 Jitter=0.5 Steps=5
time="2023-10-30T21:00:17.488Z" level=info msg="Executor initialized" deadline="0001-01-01 00:00:00 +0000 UTC" includeScriptOutput=false namespace=appanalysis-dev podName=retries-with-hooks-and-artifactm8mr9-success-2102555102 template="{\"name\":\"success\",\"inputs\":{},\"outputs\":{},\"metadata\":{},\"container\":{\"name\":\"\",\"image\":\"python:alpine3.6\",\"command\":[\"sh\",\"-c\"],\"args\":[\"echo SUCCEEDED!\"],\"resources\":{}}}" version="&Version{Version:v3.5.0,BuildDate:2023-10-13T13:06:32Z,GitCommit:bf735a2e861d6b1c686dd4a076afc3468aa89c4a,GitTag:v3.5.0,GitTreeState:clean,GoVersion:go1.21.3,Compiler:gc,Platform:linux/amd64,}"
time="2023-10-30T21:00:17.489Z" level=info msg="Starting deadline monitor"
time="2023-10-30T21:00:19.489Z" level=info msg="Main container completed" error="<nil>"
time="2023-10-30T21:00:19.489Z" level=info msg="No Script output reference in workflow. Capturing script output ignored"
time="2023-10-30T21:00:19.489Z" level=info msg="No output parameters"
time="2023-10-30T21:00:19.489Z" level=info msg="No output artifacts"
time="2023-10-30T21:00:19.489Z" level=info msg="Alloc=8450 TotalAlloc=12809 Sys=19557 NumGC=3 Goroutines=7"
@mbertelsen-kryptowire
Copy link
Author

I should explain that the python script is trying to randomly take too long and fail with the timeout about 50% of the time. I inadvertently left the commented out system.fail() in there, sorry.

@mbertelsen-kryptowire
Copy link
Author

I think it might be related to this other issue that was recently fixed, not sure.
#11589

@mbertelsen-kryptowire
Copy link
Author

It also fails to resolve the artifact with a regular exit handler (hook named exit) only.

@agilgur5 agilgur5 added area/hooks area/retry-manual Manual workflow "Retry" Action (API/CLI/UI). See retryStrategy for template-level retries P3 Low priority area/templating Templating with `{{...}}` labels Oct 31, 2023
@agilgur5 agilgur5 added P2 Important. All bugs with >=3 thumbs up that aren’t P0 or P1, plus: Any other bugs deemed important and removed P3 Low priority labels Nov 15, 2023
@dylanslavin
Copy link

dylanslavin commented Feb 2, 2024

I was able to reproduce this issue using the latest version of Argo Workflows (v3.5.4), which includes #12192. Posting a few examples for clarity on the issue that we're experiencing.

Outputs are properly recognized for steps that use EITHER lifecycle hooks, or retryStrategy:

metadata:
  generateName: artifact-hooks-
spec:
  entrypoint: all-steps
  templates:
    - name: all-steps
      steps:
        - - name: step-one
            inline:
              container:
                name: main
                image: argoproj/argosay:v2
                command:
                  - /bin/bash
                  - "-c"
                args: 
                  - "touch /output.txt"
              outputs:
                artifacts:
                  - name: output-file
                    path: /output.txt
            hooks:
              success:
                expression: 'steps["step-one"].status == "Succeeded"'
                template: exit-zero
        - - name: step-two
            inline:
              inputs:
                artifacts:
                  - name: input-file
                    path: /input.txt
              container:
                name: main
                image: argoproj/argosay:v2
                command:
                  - /bin/bash
                  - "-c"
                args: 
                  - "exit 0"
            arguments:
              artifacts:
                - name: input-file
                  from: "{{steps.step-one.outputs.artifacts.output-file}}"
    - name: exit-zero
      container:
        name: main
        image: argoproj/argosay:v2
        command:
          - /bin/bash
          - "-c"
        args: 
          - "exit 0"
image
metadata:
  generateName: artifact-retries-
spec:
  entrypoint: all-steps
  templates:
    - name: all-steps
      steps:
        - - name: step-one
            inline:
              retryStrategy:
                limit: "3"
              container:
                name: main
                image: argoproj/argosay:v2
                command:
                  - /bin/bash
                  - "-c"
                args: 
                  - "touch /output.txt"
              outputs:
                artifacts:
                  - name: output-file
                    path: /output.txt
        - - name: step-two
            arguments:
              artifacts:
                - name: input-file
                  from: "{{steps.step-one.outputs.artifacts.output-file}}"
            inline:
              inputs:
                artifacts:
                  - name: input-file
                    path: /input.txt
              container:
                name: main
                image: argoproj/argosay:v2
                command:
                  - /bin/bash
                  - "-c"
                args: 
                  - "exit 0"
image

But if the step with outputs uses retries AND hooks, then the step after it does not recognize the output of the first step:

metadata:
  generateName: artifact-retries-hooks-
spec:
  entrypoint: all-steps
  templates:
    - name: all-steps
      steps:
        - - name: step-one
            inline:
              retryStrategy:
                limit: "3"
              container:
                name: main
                image: argoproj/argosay:v2
                command:
                  - /bin/bash
                  - "-c"
                args: 
                  - "touch /output.txt"
              outputs:
                artifacts:
                  - name: output-file
                    path: /output.txt
            hooks:
              success:
                expression: 'steps["step-one"].status == "Succeeded"'
                template: exit-zero
        - - name: step-two
            inline:
              inputs:
                artifacts:
                  - name: input-file
                    path: /input.txt
              container:
                name: main
                image: argoproj/argosay:v2
                command:
                  - /bin/bash
                  - "-c"
                args: 
                  - "exit 0"
            arguments:
              artifacts:
                - name: input-file
                  from: "{{steps.step-one.outputs.artifacts.output-file}}"
    - name: exit-zero
      container:
        name: main
        image: argoproj/argosay:v2
        command:
          - /bin/bash
          - "-c"
        args: 
          - "exit 0"
image

The failed node includes the following message:

unable to resolve references: Unable to resolve: "steps.step-one.outputs.artifacts.output-file"

@shuangkun shuangkun self-assigned this Mar 6, 2024
shuangkun added a commit to shuangkun/argo-workflows that referenced this issue Mar 18, 2024
…2109

Signed-off-by: shuangkun <tsk2013uestc@163.com>
@shuangkun
Copy link
Member

It should be that the hook node was selected probabilistically when building LocalScope.

shuangkun added a commit to shuangkun/argo-workflows that referenced this issue Mar 18, 2024
…2109

Signed-off-by: shuangkun <tsk2013uestc@163.com>
shuangkun added a commit to shuangkun/argo-workflows that referenced this issue Mar 19, 2024
…2109

Signed-off-by: shuangkun <tsk2013uestc@163.com>
juliev0 pushed a commit that referenced this issue Mar 30, 2024
…2815)

Signed-off-by: shuangkun <tsk2013uestc@163.com>
@agilgur5 agilgur5 added this to the v3.5.x patches milestone Apr 19, 2024
agilgur5 pushed a commit that referenced this issue Apr 19, 2024
…2815)

Signed-off-by: shuangkun <tsk2013uestc@163.com>
(cherry picked from commit 54106f7)
@agilgur5 agilgur5 added area/retryStrategy Template-level retryStrategy and removed area/retry-manual Manual workflow "Retry" Action (API/CLI/UI). See retryStrategy for template-level retries labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hooks area/retryStrategy Template-level retryStrategy area/templating Templating with `{{...}}` P2 Important. All bugs with >=3 thumbs up that aren’t P0 or P1, plus: Any other bugs deemed important type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants