Logical AND operation of rules

Problem to solve

Describe your question in as much detail as possible:
We want to trigger specific jobs with specific trigger tokens.

  • What are you seeing, and how does that differ from what you expect to see?
    The trigger tokens are activated but the CI/CD rules do not act on the trigger tokens.
    What’s the correct syntax (operator precedence, brackets, etc.)?

Thanx for any hint! :slight_smile:

Steps to reproduce

    - if: $CI_PIPELINE_SOURCE == "trigger" && $CI_TRIGGER_SHORT_TOKEN == '83eb'
      when: always
    - if: $CI_COMMIT_BRANCH == 'main'
      when: manual


Please select whether options apply, and add the version information.

  • Self-managed
  • GitLab.com SaaS
  • Self-hosted Runners


  • GitLab: GitLab Community Edition v17.0.1

Not sure but I think CI_TRIGGER_SHORT_TOKEN is not defined at the point where you’re using it so the first if always evaluates to false. The documentation on pre-defined variables lists it as defined for jobs only. The CI_PIPELINE_SOURCE variable on the other hand is defined for the pipeline as a whole.

Any particular reason you need check on CI_TRIGGER_SHORT_TOKEN?