Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Gerrit trigger on all branches except master

I have a build in Jenkins triggered by Gerrit I would like to trigger on all branches except master. What regex should I use for this?

like image 724
Kara Avatar asked Jun 17 '13 19:06

Kara


People also ask

How does Gerrit trigger Jenkins?

Dynamic triggering 0 of the plugin, a new way of configuring what projects, branches and files to trigger on is available. By checking the checkbox "Dynamic Trigger Configuration", the user is asked for the URL to a file. Branch and file lines are assumed to be part of the closest preceding project line.

How does Gerrit integrate with Jenkins?

Jenkins SetupCreate a new Multibranch Pipeline item. Select Branch Source of type Gerrit . Specify project repository URL, only http or https based protocol is supported at this point, copy the URL from project settings at Gerrit. Trigger Scan Multibranch Pipeline now either manually or by external trigger.


2 Answers

Using a negative lookahead worked for me:

^(?!.*master).*$

Should trigger on everything except master. Kudos to this questions answers.

like image 113
romanofski Avatar answered Oct 15 '22 04:10

romanofski


The following worked for me:

^(master.+|(?!master).*)$

This excludes master only. Not master_joda, for example.

It is also based on these answers.

like image 33
Aleksey Kasatkin Avatar answered Oct 15 '22 05:10

Aleksey Kasatkin