Support use of array input type with expand_vars
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Proposal
expand_vars only works with the String input type. If you try to use expand_vars on another input type, the CI configuration is considered invalid. For example, with this CI/CD component...
spec:
inputs:
test:
type: array
default:
- 'Here is $VAR_1'
- 'And here is $VAR_2'
---
test-job:
script: echo $[[ inputs.test | expand_vars ]]
...you get this error message: "error in 'expand_vars' function: invalid input type: expand_vars can only be used with string inputs."
In #387632 (closed), where expand_vars was conceived, there's talk of adapting expand_vars to work with other data types, like Arrays: #387632 (comment 1550595104)
This is a proposal to implement that, and allow expand_vars to work with the Array input type.
Workarounds
I haven't identified a workaround. I tried adapting one described in this issue thread, but it failed with the same error message:
spec:
inputs:
test:
type: array
default:
- "$[[ $VAR_1 | expand_vars ]]"
- "$[[ $VAR_2 | expand_vars ]]"
---
test-job:
script: echo "$[[ inputs.test ]]"