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.0from master - Create branch
releasefrom 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.0the jobtestiswhen: never - On branch
releasethe jobtestiswhen: manual
What is the expected correct behavior?
- On branch
release-1.0the jobtestiswhen: manual - On branch
releasethe jobtestiswhen: manual
Output of checks
This happens on both gitlab.com and on a private instance of GitLab.