Search code examples
gitlabyamlpipelinegitlab-cigitlab-ci-runner

GitlabCI run pipeline on specific branch using wild card


I want to trigger a pipeline everytime the current milestone branch changes it works fine with hardcoded milistone number the problem is that we increase the milestone number, every 2 weeks and gitlab runner doesn't parse .gitlab-ci.yml wildcards so things like that not working

job:
  only:
    - milestone-*

i also tried regex as suggested BY Makoto Emura here at the comments

java:
  only:
    - /^mileston-.*$/

for now i use it this way and update my .gitlab-ci.yml after creating a new milestone

job:
  only:
    - milestone-10

I try to look for an environment variable for target branch but didn't find any

Does anyone know a solution?


Solution

  • I tested with this regex and it works :

        only:
        - /^milestone-.*$/
    

    In your comment, you wrote /^mileston-.*$/ instead of /^milestone-.*$/ (the e is missing at the end of milestone)