Unquoted expressions in WorkflowTemplate resource manifest fail validation #10924
Closed
3 tasks done
Labels
area/templates/resource
area/templating
Templating with `{{...}}`
P1
High priority. All bugs with >=5 thumbs up that aren’t P0, plus: Any other bugs deemed high priority
P3
Low priority
type/bug
Pre-requisites
:latest
What happened/what you expected to happen?
When submitting a workflow template that has a 'complex'=(not directly resolvable) unquoted expression (see attached workflow's containerPort in the resource manifest) we get a validation error which is a false positive. It occurs because the expression remains unresolved which breaks the yaml syntax during the unmarshalling.
It is a valid concern because as we know all input parameters are strings (or at least should be according to the schema), so there are cases when we must cast the string to a type which is expected by the applied resource's manifest (e.g: containerPort).
The current 'workaround' is to have the input parameter's value supplied as an int (unquoted):
So that in the resource manifest we can reference the input parameter directly and unquoted (i.e:
containerPort: {{inputs.parameters.intParam}}
), which works because it is not an expression and is replaced with a placeholder before yaml validation, but there are several issues with that:The solution is quite simple - basically we should replace the unresolved expressions with placeholders as well, so that the yaml unmarshalling succeeds - just for validation (because the actual expression evaluation will happen later). Will have a PR submitted later today.
Version
latest
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: