[Releasing via the maven-release-plugin, Git repos hosted on Atlassian Stash which triggers build pipeline in Jenkins.]
Is there a way to stop the release triggering a new run of the pipeline? This occurs because the released pom files are committed back to Stash. Given a build has just occurred (to get to the release job) this is entirely unnecessary as all that has changed from the last build is pom file version numbers.
Jenkins git plugin can be configured to ignore certain commit messages, [maven-release-plugin]
in your case.
Note that the example in the help test for ignore commits has some problems, try my version: ^(?s)\[maven-release-plugin\].*
Thanks @blackbuild.
That didn't actually work, I think because we are not polling from Jenkins, but rather triggering a build from Stash (commits).
So, in our case, I think the answer is to perform release builds with a specific (restricted) user, which can then be ignored from the Stash end.
However, I think your answer is good for those who are polling Git repo direct from the Jenkins server :)
Thanks loads! Andrew
I am stuck with an old version of Jenkins (v1.487) and the version of the git plugin we have does not have an option for Additional behaviors
.
I had to use a similar but not exactly the same solution as @Andrew Eells.
I have Jenkins polling a git repo and building when changes are found. My build was in an infinite loop for a bit, rebuilding when ever the release plugin pushed a pom.xml
update at the end of the build.
To solve this, I set up a specific user in Github (not using Stash here but same conceptually) to always do the builds. I then added it to the advanced section of the git plugin in Jenkins under Excluded Users
. Basically the same as Andrew's answer but configured to ignore the user from the Jenkins end instead of Stash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With