Loading
Allow hyphenated input names in CI array index access
What does this MR do and why?
CI/CD inputs can have hyphenated names and array values, but accessing an array element by index failed when the input name contained a hyphen:
spec:
inputs:
supported-versions:
type: array
default: ['2.0', '1.0']
---
test:
script: echo $[[ inputs.supported-versions[0] ]]This was rejected with invalid array index syntax in `inputs.supported-versions[0]`, while inputs.supported_versions[0] worked.
The indexed-segment pattern in Interpolation::Access only allowed word
characters for the base key. This MR accepts hyphens there too, matching the
pattern already used for input names in
Gitlab::Ci::Pipeline::Expression::Lexeme::Input.
Resolves #627813 (closed)
References
How to set up and validate locally
- Open the CI/CD pipeline editor (or the CI Lint page) in any project.
- Paste the configuration from the description above.
- Before this change, validation fails with
invalid array index syntax. - After this change, the configuration is valid and the merged YAML shows
script: echo 2.0.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Manuel Grabowski