I'm using Jenkins Pipeline to automatically build and deploy my Java apps. I also use maven-release-plugin to perform Maven deploy to Artifactory.
The problem is my Jenkinsfile (or Jenkins Pipeline Configuration) :
- We commit a version 0.1.00-SNAPSHOT on release branch
- Jenkins Pipeline get the code, and perform maven release
- Maven Release changes the version to 0.1.00
- Maven Release tags GIT branch, commit and deploy the artifact
- Maven Release changes the version to 0.2.00-SNAPSHOT and commit
- Jenkins Pipeline detect a change in GIT, so triggers a new build
You understood that the last step creates an infinite loop, even if there is no useful commit.
Here is the interesting part of my Jenkinsfile :
sshagent([git_credential]) { sh "${maven_bin} --settings ${maven_settings} -DreleaseVersion=${release_version} -DdevelopmentVersion=${development_version} release:prepare release:perform -B"
}
How can I break the loop (avoid Jenkins to trigger new build when Maven commits on GIT)?
Thanks