Skip to content

Fix error from using `inputs` in some cases

Avielle Wolfe requested to merge 436631-fix-inputs-rules-schema-error into master

What does this MR do and why?

A CI config linting error is being raised when using include:inputs with include:rules. It likely also occurs when matching include:inputs with other include subkeywords.

The fix is to include inputs in the allowed keys for the includes entry class.

Changelog: fixed

Issue: #436631 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot 2024-02-13 at 14.56.54.png Screenshot 2024-02-13 at 14.55.33.png

How to set up and validate locally

  1. Create a file named included.yml in a project's root directory. Give it this content:

    spec:
      inputs:
        stage:
    
    ---
    
    test:
      stage: $[[ inputs.stage ]]
      script: ls
    
  2. In the CI editor, put this content:

    include:
      - local: included.yml
        inputs:
          stage: test
        rules:
          - if: $CI_COMMIT_BRANCH == "main"
    
    build:
      script: ls
  3. See that the config has no errors

Edited by Avielle Wolfe

Merge request reports