So I have the following job I created. I want the job to run only if the Value of VERSION is "TEST-INPUT". All other cases the job fails. How would I do this? So far, If I enter any value for VERSION in GITLAB, the job still runs.
test-manual-job:
stage: test-stage
when: manual
variables:
VERSION: "${VERSION}"
rules:
- if: '$VERSION == "TEST-INPUT"'
allow_failure: true
script:
- echo "${VERSION} is the hard-coded input"
rules:are only evaluated when the pipeline is created. When you are starting a manual job, specifying any variables will not affect whether the job runs or not because therules:were evaluated at pipeline creation time.Since you want to evaluate this condition after pipeline creation time, you can't use
rules:. Instead, you can just add this logic to the job itself: