Tag rule fails

GitLab community version 17.4.2.

Each time I commit to the main branch, I have a job that doesn’t execute. I’m also not sure I’m doing this correctly. The job doesn’t execute because of the following rule.

variables:
    RE: '/^v\d+.\d+.\d+-?.*$/'

rules:
  - if: $CI_COMMIT_BRANCH=='main' && $CI_COMMIT_TAG =~ $RE

If I comment out the regular expression part, it works fine. The proces I use is, 1) create a lightweight git tag, 2) push it to remote, 3) either push code to the main branch or manually start a pipeline and select the tag. Either way, the regular expression fails for this tag, v1.2.0-dev.1.

Am I working the process correctly? Thoughts?

Hi,

I’m not sure what you’re trying to achieve. The current rules:if has two conditions, and the pipelines will only run if both are true.
But if you want the pipeline to start every commit anyway and a tag for certain situations, then you need two ifs, like this:

rules:
  - if: $CI_COMMIT_BRANCH=='main' 
  - if: $CI_COMMIT_TAG =~ $RE