argoproj / argoproj/argo-workflows
Report when defaults are being used from valueFrom
- Dominant language
- Go
- Stars
- 17k
- Forks
- 3.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 138
Description
# Summary
Currently workflowTemplates can have default values when unable to read the value. However, it currently will just say it failed to read the source and doesn't tell you it is using a default value.
It would be great to log that argo is resolving the parameter with the default
Eg workflow:
```
apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
name: i-am-groot
spec:
schedule: "*/10 * * * *"
timezone: "America/Los_Angeles"
concurrencyPolicy: "Forbid"
spec:
workflowSpec:
entrypoint: foo
templates:
- name: foo
steps:
- - name: stepA
template: stepA-template
- - name: stepB
template: stepB-template
withParam: "{{steps.stepA.outputs.parameters.blarg}}"
arguments:
parameters:
- name: bar
value: "{{item}}"
- name: stepA-template
outputs:
parameters:
- name: blarg
valueFrom:
default: '[]'
path: "/tmp/out.json"
container:
name: stepA-container
image: python:3.8.14-alpine3.15
command: [python3]
args: ["-c", "\"import sys; sys.exit(0)\"", " > /tmp/out.json"]
- name: stepB-template
inputs:
parameters:
- name: bar
container:
name: stepB-container
image: alpine:latest
command: [sh]
args: ["echo {{inputs.parameters.bar}}"]
```
Which will currently log:
`level=error msg="cannot save parameter /tmp/out.json" argo=true error="open /tmp/out.json: no such file or directory"`
But should also say something like:
`using default value '[]'`
# Use Cases
When would you use this?
I got lost down a rabbithole of wondering why something wasn't working when it was. This would make the logs clearer in workflows.
---
**Message from the maintainers**:
Love this enhancement proposal? Give it a 👍. We prioritise the proposals with the most 👍.
Contributor guide
Research direction
Start by tracing workflow parameter resolution for outputs using valueFrom, focusing on the existing "cannot save parameter" error shown in the issue. Done means a failed source read still reports that the configured default value is being used, with coverage for the example behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100