Predefined variable CI_COMMIT_BRANCH not present in job

I’m running gitlab-runner version 13.5.0, and I’m trying to use the predefined variable CI_COMMIT_BRANCH in workflow:rules as such:

rules:
    - if: '$CI_COMMIT_BRANCH == "master"'
      when: manual

however it would not trigger the creation of a manual job, so I ran the ‘export’ command to reveal variable values, and the CI_COMMIT_BRANCH is not present. I’ve tested the job with a workflow:rules condition and the job is created successfully.

To trigger the job, I made a commit locally on master branch, and added a tag, then pushed to gitlab.

I can’t figure out if the CI_COMMIT_BRANCH is suppose to present in this scenario or if I’m experiencing a bug.

I appreciate any help!

I have a similar problem (I don’t know if you figured that out).

The $CI_COMMIT_BRANCH and $CI_COMMIT_BRANCH are always set to branching_name_cache. Any idea how that is possible?