1

I'm aware of for instance -only that let us running jobs on specific branch or tag.
I'm just wondering whether one can do similar thing with predefined environment variables only.
Well, it's just a matter of curiosity than a real need.

Thanks.

1 Answer 1

1

Yes, you can use only:variables:/except:variables: or you can use rules:

myjob:
  # ...
  only:
    variables:
      - $FOO == "bar"

or with rules:

myjob:
  rules:
    - if: '$FOO == "bar"'

You can use most of the predefined variables for use in rules: or only:variables/except:variables:.

You can use variables like CI_COMMIT_BRANCH or CI_COMMIT_TAG to control when a job runs for particular branches/tags.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.