Skip to content

Backend: CI interpolation with arrays

Problem

Users want to be able to pass arrays into included CI config files using CI inputs.

Proposal

The input definition can be written like:

spec:
  inputs:
    rules:
      type: array
      default:
        - 'item 1'
        - 'item 2'

You can see a more complex example here: !136075 (closed)

These inputs can be used like:

test:
  script: $[[ inputs.script ]] # defines entire script

And:

test:
  script:
    - echo "first line"
    - $[[ inputs.script ]] # gets inserted between other script items
    - echo "last line"

Questions

Should the following be invalid and return an error?

test:
  script:
    - echo "I am $[[ inputs.script ]]"

Answer: yes! no, it should just be stringified and inserted

Relevant user research insight

Edited by Avielle Wolfe