You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When composing pipelines with variable inputs, sometimes we want to only support a limited number of options for the variable.
A simple example may be var.route which we may limit to wanting to be one of:
"a"
"b"
"c"
As we use this variable to decide which child pipeline to initiate.
However, at the current time in order to achieve this, we have to run tests to cater for each potential value and then have another step that contains an if to check that the value isn't one we allow:
step"<pipeline/message/whatever>""bad_route" {
if=var.route!="a"&& var.route!="b"&& var.route!="c"...// potentially throw here to end the pipeline
}
This approach comes with a few issues:
Increased complexity when designing pipelines to cater for these events
Issues with the value for variables only become noticed at runtime
Desired Solution
We do currently validate the type of the variable at parse time to ensure that a string is a string, etc. It would be beneficial if we could also validate the contents of the value against a "rule" at parse time also.
This would reduce complexity around having to have the pipelines themselves handle/cater for invalid inputs as well as highlight these issues when loading the mod with vars/var-files.
Looking at HCL variables in Terraform, they have a clear and useful approach to variable validations: docs
Alternative Solution
We could implement a different approach to variable validation, but this would be custom and differentiate from the expectations of anyone who has used variable validation with Terraform may be expecting.
The text was updated successfully, but these errors were encountered:
Context
When composing pipelines with variable inputs, sometimes we want to only support a limited number of options for the variable.
A simple example may be
var.route
which we may limit to wanting to be one of:As we use this variable to decide which child pipeline to initiate.
However, at the current time in order to achieve this, we have to run tests to cater for each potential value and then have another step that contains an
if
to check that the value isn't one we allow:This approach comes with a few issues:
Desired Solution
We do currently validate the
type
of the variable at parse time to ensure that astring
is astring
, etc. It would be beneficial if we could alsovalidate
the contents of the value against a "rule" at parse time also.This would reduce complexity around having to have the pipelines themselves handle/cater for invalid inputs as well as highlight these issues when loading the mod with vars/var-files.
Looking at HCL variables in Terraform, they have a clear and useful approach to variable validations: docs
Alternative Solution
We could implement a different approach to variable validation, but this would be custom and differentiate from the expectations of anyone who has used variable validation with Terraform may be expecting.
The text was updated successfully, but these errors were encountered: