Regex for rules in CI/CD jobs does not work
Summary
Regex in the rule block of a CI job does not work.
Steps to reproduce
- Create minimal project with below
.gitlab-ci.yaml
. - Create branch
release-1.0
from master - Create branch
release
from master
Example Project
https://gitlab.com/sanofi_foldager/ci-rules-regex-bug
# File: .gitlab-ci.yaml
test:
script:
- echo $CI_COMMIT_REF_NAME
rules:
- if: $CI_COMMIT_REF_NAME == "master"
when: on_success
- if: $CI_COMMIT_REF_NAME =~ "/^release/"
when: manual
- when: never
dummy:
script:
- echo hello world!
What is the current bug behavior?
- On branch
release-1.0
the jobtest
iswhen: never
- On branch
release
the jobtest
iswhen: manual
What is the expected correct behavior?
- On branch
release-1.0
the jobtest
iswhen: manual
- On branch
release
the jobtest
iswhen: manual
Output of checks
This happens on both gitlab.com and on a private instance of GitLab.