Skip to content

Add array types to CI inputs

Avielle Wolfe requested to merge 407176-add-array-input-type into master

What does this MR do and why?

Arrays can be used both independently and to add items to an existing array.

Changelog: added

Issue: #407176 (closed)

How to set up and validate locally

  1. In a project's root directory, create a file included.yml

    spec:
      inputs:
        echo:
          type: array
        needs:
          type: array
        rules:
          type: array
    
    ---
    
    test_job:
      needs: $[[ inputs.needs ]]
      rules: $[[ inputs.rules ]]
      script: echo '$[[ inputs.echo ]]'
  2. In the project's .gitlab-ci.yml, put:

    include:
      - local: included.yml
        inputs:
          needs:
            - build
          rules:
            - if: $RUN_MANUAL
              when: manual
          echo:
            - test
            - array
    
    build:
      script: ls
  3. Check that the full configuration is:

    build:
      script: ls
    
    test_job:
      needs:
        - build
      rules:
        - if: $RUN_MANUAL
          when: manual
      script: echo '["test", "array"]'
Edited by Avielle Wolfe

Merge request reports