Support array index operator [] for CI/CD input interpolation

Problem to solve

Currently, when using array-type inputs in CI/CD pipelines, users can only reference the entire array. There is no way to access individual elements of an array input during interpolation, which limits the flexibility of array inputs.

Proposal

Introduce bracket notation with zero-based indexing to access individual elements of array inputs during interpolation using the $[[ ]] syntax.

Example usage:

spec:
  inputs:
    supported_versions:
      type: array
      default:
        - '2.0'
        - '1.0'
        - '0.1'
---

job:
  script:
    # Outputs: 'Latest version is 2.0'
    - echo 'Latest version is $[[ inputs.supported_versions[0] ]]'

Additional capabilities:

  • Chaining with dot notation for nested values: $[[ inputs.servers[0].host ]]
  • Multi-dimensional arrays: $[[ inputs.matrix[0][1] ]]
  • Compatibility with interpolation functions: $[[ inputs.items[0] | truncate(0,5) ]]

Limitations

  • Only non-negative integer indices are supported (0, 1, 2, ...)
  • Negative indices are not supported

Error handling

Clear error messages for:

  • Index out of bounds
  • Attempting to index non-array values
  • Invalid index format
Edited Jan 26, 2026 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading