argoproj / argoproj/argo-workflows
Support exitCode on aggregated output
- Dominant language
- Go
- Stars
- 17k
- Forks
- 3.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 138
Description
# Summary
Currently argo only supports using aggregated outputs (e.g. `tasks.execute-parallel-steps.outputs.result`) in parameter
https://argo-workflows.readthedocs.io/en/stable/walk-through/loops/#accessing-the-aggregate-results-of-a-loop
but not aggregated exitCode `tasks.execute-parallel-steps.outputs.exitCode` or `tasks.execute-parallel-steps.exitCode`,
this could be useful when we want to determine which direction the workflow should proceed after the the `withParam`/`withSequence`/`withItems` step.
We would like to use the following workflow construct
```yaml
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: loop-test-
spec:
entrypoint: main
templates:
- name: main
dag:
tasks:
- name: execute-parallel-steps
template: print-json-entry
arguments:
parameters:
- name: index
value: '{{item}}'
withParam: '[0, 1]'
- name: call-access-aggregate-output
depends: "execute-parallel-steps.Failed"
template: access-aggregate-output
arguments:
parameters:
- name: aggregate-results
value: '{{tasks.execute-parallel-steps.exitCode}}' # 👈
- name: print-json-entry
inputs:
parameters:
- name: index
container:
image: alpine:latest
command: [sh, -c]
args: ["echo intentional failure; exit {{inputs.parameters.index}}"]
- name: access-aggregate-output
inputs:
parameters:
- name: aggregate-results
value: 'no-value'
script:
image: alpine:latest
command: [sh]
source: |
echo 'inputs.parameters.aggregate-results: "{{inputs.parameters.aggregate-results}}"'
```
`tasks.execute-parallel-steps.exitCode` passes template validation but won't evaluate

---
**Message from the maintainers**:
Love this feature request? Give it a 👍. We prioritise the proposals with the most 👍.
Contributor guide
Research direction
Start with the loop aggregate-results documentation and reproduce the supplied workflow in a Kubernetes-backed Argo environment. Trace how tasks.*.outputs.result is resolved and compare it with the requested tasks.*.exitCode forms. Done means aggregate exit-code expressions evaluate for withParam, withSequence, and withItems cases, with the behavior covered by project tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100