Add inputs to git push options

What does this MR do and why?

Add push option for inputs. Similar to what we did for variables, the syntax will be ci.input (rather than inputs) since we are going to send inputs separately, like so:

git push -o ci.input="level=10" -o ci.input="stage=deploy"

How to test

In a project with spec:inputs :

spec:
  inputs:
    scan_security:
      description: 'Whether to run securiy scans'
      type: boolean
      default: true
    level:
      description: 'Level of happiness'
      type: number
      default: 1
---
level-job:
  stage: test
  script: 
    - echo 'only building this if level is 10'
  rules:
    - if: '"$[[ inputs.level ]]" == "10"' 

security-scan:
  stage: test
  script:
    - echo "Running security scans"
  rules:
    - if: '"$[[ inputs.scan_security ]]" == "true"'

When you first run a pipeline, you should not see the level-job (since the default will be 1 and will be excluded with the rules) and you should see security-scan .

Make a change and push with the options: git push -o ci.input="level=10" -o ci.input="scan_security=false"

You should now see only level-job

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Laura Montemayor

Merge request reports

Loading