Kara
Kara

Reputation: 6226

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?

Upvotes: 16

Views: 16250

Answers (2)

Aleksey Kasatkin
Aleksey Kasatkin

Reputation: 31

The following worked for me:

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

This excludes master only. Not master_joda, for example.

It is also based on these answers.

Upvotes: 3

romanofski
romanofski

Reputation: 1132

Using a negative lookahead worked for me:

^(?!.*master).*$

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

Upvotes: 30

Related Questions