16

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?

Kara
  • 5,996
  • 16
  • 49
  • 56
  • 1
    Check this out: https://github.com/jenkinsci/git-plugin/pull/45. Also more comments here: https://issues.jenkins-ci.org/browse/JENKINS-7087. I don't understand enough to translate these comments into a solution, but if you could, it'd be great if you could type up an answer yourself for future users. – slackwing Jun 17 '13 at 21:50
  • 1
    @acheong87 Unfortunately the solution you found only works if you are using the git plugin directly, I have the Choosing Strategy set to Gerrit Trigger so it will not work for me. – Kara Jun 17 '13 at 22:39

2 Answers2

29

Using a negative lookahead worked for me:

^(?!.*master).*$

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

Community
  • 1
  • 1
romanofski
  • 1,112
  • 1
  • 12
  • 18
2

The following worked for me:

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

This excludes master only. Not master_joda, for example.

It is also based on these answers.