-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
expression {{= workflow?.outputs?.parameters?.my_param ?? 'na' }}
always return na
#11549
Comments
Would adding default parameter value work? |
This comment was marked as resolved.
This comment was marked as resolved.
Hi, it's also the same story with templateDefaults:
metrics:
prometheus:
- name: exec_duration_gauge
labels:
- key: workflow_name
value: "{{workflow.name}}"
- key: workflow_namespace
value: "{{workflow.namespace}}"
- key: pod_name
value: "{{=pod?.name ?? 'na'}}"
help: "Duration gauge by pod name"
gauge:
realtime: true
value: "{{duration}}" |
Hmm, I wonder if the parser is getting confused by the safe conditional -- since it can't directly look up Does re-writing it without the safe conditional short-hand, e.g. as |
Thanks for your suggestion, but it seems all node fails with this message.
There are more messages stated from
Tried |
Thanks for checking that! That's strange that |
I'm afraid this doesn't work either. Attaching the error message.
I'm not really familiar with the source code, but I guess the string |
Thanks for testing this out and confirming!
I know there's a good bit of It honestly might be ripe for a refactor to consolidate more of the expression code into one place so that there are less bugs and it's easier to modify holistically. (Not to mention some existing large confusions with the different templating engines: #5142, #9529, #7831, etc). I've been meaning to jump into Argo's templating and start addressing lots of issues, but haven't had a chance to do so yet.
Oh nice find! I think you might be correct on that one, which would explain quite a bit. I think this is because the |
For search purposes, adding the keywords: optional chaining |
Pre-requisites
:latest
What happened/what you expected to happen?
Running workflow with global output parameter, that is used in metrics label value with expression containing "??" always evaluates as if the parameter value is
nil
. The reason for using the condition is to support step failing, when the outputs are not generated and in that case I want to fallback to"na"
.Running the workflow below, after completed, the value of
.spec.metrics
isExpected value is:
To check, the value of
.status.outputs
is correct as expected:When setting the expression to
"{{= workflow?.outputs?.parameters?.my_global_param }}"
(i.e. removing the safe conditional), the evaluated value in the metric label is correct.Version
v3.4.9
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.
Logs from the workflow controller
Logs from in your workflow's wait container
The text was updated successfully, but these errors were encountered: