Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop mvn release triggering repeat Jenkins builds

[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.

like image 788
Andrew Eells Avatar asked Sep 03 '15 08:09

Andrew Eells


3 Answers

Jenkins git plugin can be configured to ignore certain commit messages, [maven-release-plugin] in your case.

enter image description here

Note that the example in the help test for ignore commits has some problems, try my version: ^(?s)\[maven-release-plugin\].*

like image 197
blackbuild Avatar answered Oct 13 '22 23:10

blackbuild


Thanks @blackbuild.

That didn't actually work, I think because we are not polling from Jenkins, but rather triggering a build from Stash (commits).

Stash webhook to Jenkins

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.

Committers to ignore

However, I think your answer is good for those who are polling Git repo direct from the Jenkins server :)

Thanks loads! Andrew

like image 42
Andrew Eells Avatar answered Oct 14 '22 01:10

Andrew Eells


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.

enter image description here

like image 1
Jeremy Avatar answered Oct 14 '22 00:10

Jeremy