Stop mvn release triggering repeat Jenkins builds

六眼飞鱼酱① 提交于 2019-12-10 14:32:31

问题


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


回答1:


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\].*




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/32371073/stop-mvn-release-triggering-repeat-jenkins-builds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!