Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.gitlab-ci.yml: How to specify "only/except" rules with a regex AND repo-specific qualifier?

In the only section of my .gitlab-ci.yml I can match a branch name by regex like:

  only:
    - /^issue-.*/

and match a branch name for a specific branch and repo like:

  only:
    - issue-123@mygroup/myproject

But how do I do both? I tried this:

  only: 
    - /^issue-.*@mygroup\/myproject/

but with no success.

I'm using GitLab Community Edition 8.17.4.

like image 231
nocnokneo Avatar asked Apr 03 '17 20:04

nocnokneo


1 Answers

It appears the group/project name part cannot be part of the regex in 8.17.

Testing with gitlab 8.17.5-ce, I can use regex for the branch name followed by string only group/project name to select specific branches to build on, like this:

  only:
  - /^issue-.*/@mygroup/myproject

In context:

stages:
 - build

build-any-issue-on-mygroup-myproject:
  stage: build
  script:
    - echo "hello"
  only:
    - /^issue-.*/@mygroup/myproject
like image 77
spacepickle Avatar answered Nov 15 '22 09:11

spacepickle