fix(validate): validate placeholder step names#15991
Open
thevilledev wants to merge 1 commit intoargoproj:mainfrom
Open
fix(validate): validate placeholder step names#15991thevilledev wants to merge 1 commit intoargoproj:mainfrom
thevilledev wants to merge 1 commit intoargoproj:mainfrom
Conversation
ProcessArgs substitutes "{{inputs.parameters.xxx}}" with
"__argo__internal__placeholder-N" before validation runs.
That placeholder contains underscores which fail the K8s
naming regex, rejecting previously valid dynamic step
names. Validate placeholder-based step names without
weakening other workflow field checks, and keep rejecting
invalid literal name skeletons.
Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15896
Motivation
After #15744 fixed placeholder leakage for inline template sources, validation still rejected step names that contained
{{inputs.parameters.*}}.ProcessArgssubstitutes internal placeholder tokens beforevalidateStepsruns, so names like:become:
run-__argo__internal__placeholder-Nduring validation. They fail the workflow field-name regex because the placeholder contains underscores, against k8s naming regex.
The previous branch version skipped validation for any name containing a placeholder. That broadened the change beyond the reported step-name regression and weakened unrelated field validation. This PR keeps the fix scoped to step names.
Modifications
Add placeholder-aware step-name validation in
workflow/validate/validate.go. The validator now replaces internal placeholder fragments with a short valid sentinel ("x") before applying the existing workflow field-name rules. This allows dynamic step names to pass validation while still checking the literal name skeleton aroundthe placeholder.
Keep
validateWorkflowFieldNamesunchanged so template names, parameter names, artifact names, and DAG task names continue to use their existing validation paths.Add regression tests for the reported
templateRefscenario and the equivalent local-steps case. Add a negative test that verifies invalid literal step names such asrun_{{inputs.parameters.date}}still fail validation.Verification
Added regression coverage for the scenario from #15896 and for a local workflow variant. Verified that valid dynamic step names now pass and that invalid literal skeletons still fail.
Documentation
No documentation changes needed. This is a validation bugfix.