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

fix: consistent variable substitution for configMapKeyRef. Fixes #13890 #13921

Merged
merged 2 commits into from
Nov 24, 2024

Conversation

MasonM
Copy link
Contributor

@MasonM MasonM commented Nov 19, 2024

Fixes #13890

Motivation

Support for substituting variables in configMapKeyRef was added in #7542 by manually parsing templates out of the string, instead of using the standard template.Replace() function. Since the manual parsing logic uses the same syntax as simple template tags (e.g. {{workflow.parameters.cm-name}}), users reasonably expect it to work the same, but it doesn't, which leads to confusion. Additionally, supporting templates like {{workflow.parameters.cm-name}}-cm is important, because that's a common pattern.

Modifications

This replaces the manual parsing code with the standard template.Replace() function that everything else uses.

Verification

Verified by running the example workflow from #13890 locally:
image

…proj#13890

Support for subsituting variables in `configMapKeyRef` was added in
argoproj#7542 by manually parsing
templates out of the string instead of using the standard
`template.Replace()` functionality. Since the templates have the same
syntax as simple template tags (e.g. `{{workflow.parameters.cm-name}}`),
users reasonably expect it to work the same, but it doesn't, which leads
to confusion.

This replaces the manual parsing code with the standard
`template.Replace()` function that everything else uses.

Signed-off-by: Mason Malone <[email protected]>
@MasonM MasonM added the area/templating Templating with `{{...}}` label Nov 19, 2024
@MasonM MasonM changed the title fix: consistent variable substitution for configMapKeyRef. Fixes #13890 fix: consistent variable substitution for configMapKeyRef. Fixes #13890 Nov 19, 2024
@@ -805,7 +805,7 @@ spec:
args: ["sleep", "5"]
`).When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToBeCompleted).
WaitForWorkflow(fixtures.ToBeCompleted, killDuration).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timeout increased because this test is flaky:
hooks_test.go:808: timeout after 1m30s waiting for condition
https://github.com/argoproj/argo-workflows/actions/runs/11922046836/job/33227659623?pr=13921

Signed-off-by: Mason Malone <[email protected]>
@MasonM MasonM marked this pull request as ready for review November 19, 2024 22:42
@MasonM MasonM removed the type/bug label Nov 20, 2024
@tczhao tczhao merged commit f2159dc into argoproj:main Nov 24, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/templating Templating with `{{...}}`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent variable substitution in Inputs.Parameters block
2 participants