Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hudson/jenkins keeps building the bad branch in git instead of the good one

I have jenkins set up to build any branch and merge it into master. I also have pre-receive scripts to prevent any developer from checking into master unless you are user "hudson".

It is working great on one of our repositories but on the other one, any time someone pushes a new remote branch, hudson is building a paused unworking branch and failing the build so each new push a remote branch triggers an immediate build(post-receive script calls curl) but then it tries to build that bad branch instead of the one the developer pushed.

NOTICE in the logs, it looks like it detects correctly that dhiller-1 was the latest pushed but then decides to build dhiller-refactor which is not complete but kept in remote repository as it is a big refactor that is still in progress(and pushed only for backup purposes)

logs...

Started by user anonymous
Checkout:workspace / C:\AAROOT\Jenkins2\jobs\toolbar\workspace - hudson.remoting.LocalChannel@aab87f
Using strategy: Default
Last Built Revision: Revision 597af7a5d808b28f492257f311af9171f03e6891 (origin/dhiller-1)
Checkout:workspace / C:\AAROOT\Jenkins2\jobs\toolbar\workspace - hudson.remoting.LocalChannel@aab87f
Fetching changes from 1 remote Git repository
Fetching upstream changes from ssh://[email protected]/opt/toolbar
Seen branch in repository origin/HEAD
Seen branch in repository origin/dhiller-1
Seen branch in repository origin/dhiller-2
Seen branch in repository origin/dhiller-refactor
Seen branch in repository origin/dhiller-test
Seen branch in repository origin/master
Commencing build of Revision 2c56d8645871ea2929c717e15038a5b79c0b43e1 (origin/dhiller-refactor)
Merging Revision 2c56d8645871ea2929c717e15038a5b79c0b43e1 (origin/dhiller-refactor) onto master
ERROR: Branch not suitable for integration as it does not merge cleanly
Build did not succeed and the project is configured to only push after a successful build, so no pushing will occur.
Finished: FAILURE
like image 201
Dean Hiller Avatar asked Jan 10 '12 14:01

Dean Hiller


1 Answers

Well, I finally fixed it only by completely removing that remote branch and creating a new one that had the code from that bad branch just using a copy of the files so yes I lost any history of that branch, but it fixed the issue....it was a big pain and seems to be working again now.

like image 163
Dean Hiller Avatar answered Nov 15 '22 06:11

Dean Hiller