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?
Jenkins Gerrit trigger on all branches except master
Check this out: github.com/jenkinsci/git-plugin/pull/45. Also more comments here: 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. –
Archenteron
@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. –
Elise
Using a negative lookahead worked for me:
^(?!.*master).*$
Should trigger on everything except master. Kudos to this questions answers.
If entering this in the branches specifier in Jenkins, don't forget to prepend
:
to tell Jenkins this is a regex. –
Tonne The following worked for me:
^(master.+|(?!master).*)$
This excludes master only. Not master_joda, for example.
It is also based on these answers.
© 2022 - 2024 — McMap. All rights reserved.