Pergunta

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://hudson@192.168.111.130/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
Foi útil?

Solução

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.

Outras dicas

I had the same issue. Strange thing was that Jenkins (the git-plugin) emitted the

ERROR: Branch not suitable for integration as it does not merge cleanly

message, while I had not checked the 'Merge before build' option set. Looking at the source code of the git-plugin here, it had to do with that option though. Enabling that option, saving the config, disabling the option and saving the config again, fixed the issue for me; it does not try to merge anymore.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top