Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Git Plugin Build Trigger RegEx starts wrong jobs

I am using Jenkins (v1.592) with Git Client Plugin (v1.12.0) and Git Plugin (v2.3).

I have a build-job that has to be triggered if there have been changes in my git-repository if the changes are made NOT in origin/master or origin/name branches, while N is a decimal number.

I was very happy to see, that Jenkins allowes regular expressions as a branch-specifier at the "Branches to build" option. But unfortunately I do not get my expression to work correctly:

My expression is:

:master|name(\d+)

I also activated "Strategy for choosing what to build" with option "Inverse".

When I am now pushing something onto my master-build it will be selected and the build starts.

I am using "Poll SCM" with no schedule and trigger a build with a call to the Jenkins notifyCommit URL.

I also tried to use: (?!(origin/master|origin/name\d+)) as regex without inverse option but get an error here.

like image 712
Stefan Wegener Avatar asked Dec 03 '14 15:12

Stefan Wegener


1 Answers

Okay, I found an answer, but not by finding a solution for the regex. I recently saw, that I am able to specify more than one branch with the "Add Branch" function - until few minutes ago I was blind to see the "Add Branch" button.

By specifiying two branches and activating the inverse function it works. My two branch names are: master and name* (* for the Wildcard operator).

Thanks for your help!

like image 172
Stefan Wegener Avatar answered Nov 18 '22 16:11

Stefan Wegener