Hudson/jenkins 不断在 git 中构建坏分支而不是好分支

发布于 2024-12-25 20:02:57 字数 1613 浏览 4 评论 0原文

我设置了詹金斯来构建任何分支并将其合并到主分支中。我还有预接收脚本,以防止任何开发人员签入 master,除非您是用户“hudson”。

它在我们的一个存储库上运行良好,但在另一个存储库上,每当有人推送新的远程分支时,Hudson 都会构建一个暂停的不工作分支并导致构建失败,因此每次新推送远程分支都会触发立即构建(接收后)脚本调用curl),但随后它尝试构建那个坏分支而不是开发人员推送的分支。

注意日志中,看起来它正确地检测到 dhiller-1 是最新推送的,但随后决定构建 dhiller-refactor ,该重构尚未完成,但保留在远程存储库中,因为它是仍在进行中的大型重构(并已推送)仅用于备份目的)

日志...

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

迟月 2025-01-01 20:02:57

好吧,我最终只是通过完全删除该远程分支并创建一个新分支来修复它,该新分支包含来自该错误分支的代码,仅使用文件的副本,所以是的,我丢失了该分支的任何历史记录,但它解决了问题.. ..这是一个很大的痛苦,现在似乎又开始起作用了。

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.

深爱成瘾 2025-01-01 20:02:57

我有同样的问题。奇怪的是 Jenkins(git 插件)发出了

错误:分支不适合集成,因为它没有完全合并

消息,而我没有检查“构建前合并”选项集。查看 git-plugin 的源代码 这里,不过它与该选项有关。启用该选项,保存配置,禁用该选项并再次保存配置,为我解决了问题;它不再尝试合并。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文