Reputation: 5913
I'm trying to release a Maven project using the maven-release-plugin
. The Jenkins Git plugin doesn't seem to be checking out the repo correctly.
Below is my Jenkins Job configuration
Repository URL : git@githubenterprise:/user/repo.git Branches to build: */master Repository browser: Auto Additional Behaviours: Checkout to specific local branch : master
Git Build data for the failed release shows
Revision: 267** refs/remotes/origin/origin/master Built Branches refs/remotes/origin/master: Build #4 of Revision 755** (refs/remotes/origin/master) refs/remotes/origin/origin/master: Build #10 of Revision 267*** (refs/remotes/origin/origin/master)
The job console shows
Multiple candidate revisions Scheduling another build to catch up with MyJenkinsBuildJob Checking out Revision 267** (refs/remotes/origin/origin/master)
755** is the latest commit on the repository, bu the Git Plugin is checking out 267** revision. So the build fails when the maven-release-plugin
tries to push back the release prepared release from an old commit.
The git-push command failed. Command output: To ssh://git@githubenterprise:/user/repo.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'ssh://git@githubenterprise:/user/repo.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing again.
How to make the Jenkins Git Plugin checkout only the latest revision(755* in my case) instead of trying to build multiple checkouts(not sure why it does that)
Upvotes: 2
Views: 7927
Reputation: 5913
this was due to the fact that someone had pushed a branch with name "origin/master" which matched with the Branches to build: */master
configuration which I had provided.So the Git plugin was trying to checkout both these matching branches ("master" and "origin/master") and build them
Removing the wildcard and setting the branch specifier to remotes/origin/master
solved the problem.
Upvotes: 6