使用 Jenkins/Hudson 的集成管理器 Git 工作流程

发布于 2024-12-16 22:31:42 字数 1766 浏览 0 评论 0原文

我正在尝试实现一个修改后的 Integration-Manager 工作流程,类似于 ProGit 中描述的内容。

Integration-Manager 工作流程图

我希望开发人员不使用 integration manager 执行合并在发布代码之前进行本地合并,并且我想要一个 Quality Gateway 在允许代码进入受祝福的存储库之前强制执行我们的持续集成标准,例如最低水平的代码覆盖率和 100% 测试通过被其他人检查开发商。这个想法是,受祝福的存储库中的代码始终满足我们定义并始终构建的最低标准。

我希望 Jenkins 扮演质量网关的角色,仅在构建成功时将代码推送到受祝福的存储库。

到目前为止,我已经设置了系统,以便有以下公共存储库:受祝福的存储库、Jenkins 构建服务器上的存储库,这是通过 gitosis 访问的裸存储库,当然还有开发人员自己的存储库。

我让开发人员从受祝福的存储库中撤出并推送到集成存储库。现在我试图让 Jenkins 将成功的构建从集成存储库推送到受祝福的存储库。

到目前为止,我看到的唯一与我想要实现的目标相似的选项是 Jenkins 中构建后操作的 Git 发布者设置中的“Push Only If Build Succeeds”选项' 项目配置。但是,该选项不允许您指定要推送到的推送 url 或远程。

据我了解,Git Publisher 设置会将 Jenkins 存储库的克隆推回其工作区,然后返回 Jenkins 的公共存储库,但我想推送到另一个远程、受祝福的存储库。

有人对如何让 Jenkins 推送到受祝福的存储库有任何建议吗?

编辑 0: 我尝试放置一个后步骤来执行推送命令到我的祝福存储库。这似乎有效,因为没有错误。然而,没有任何更改被推送,日志显示 git 认为一切都是最新的:

[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESSFUL 
[INFO]     ------------------------------------------------------------------------ 
[INFO] Total time: 1 minute 7 seconds 
[INFO] Finished at: Fri Nov 18 16:10:50 UTC 2011 
[INFO] Final Memory: 19M/45M 
[INFO] ------------------------------------------------------------------------ 
channel stopped 
[My Project] $ /bin/sh -xe /tmp/hudson5604254372179801803.sh + git push [email protected]:my-project.git --all
Everything up-to-date

我不知道为什么 git 认为没有什么可以推送,因为肯定有。

I'm trying to implement a modified Integration-Manager workflow similar to what's described in ProGit.

Diagram of the Integration-Manager workflow

Instead of an integration manager performing the merges, I want developers to merge locally before publishing their code, and I want a Quality Gateway that enforces our continuous integration standards, such as a minimum level of code coverage and 100% tests passing, before allowing code to enter the blessed repository to be checked out by other developers. The idea is that the code in the blessed repository always meets the minimum standard we define and always builds.

I want Jenkins to perform the role of the quality gateway, only pushing code to the blessed repository when builds succeed.

So far, I have set up the system so that there are the following public repos: the blessed repository, a repository on the build server for Jenkins, which is a bare repo accessed through gitosis, and of course developer's own repositories.

I have developers pulling from the blessed repo and pushing to the integration repo. Now I'm trying to get Jenkins to push successful builds from the integration repo to the blessed repo.

So far, the only option I've seen that seems similar to what I'm trying to achieve is the "Push Only If Build Succeeds" option in the Git Publisher settings of the Post Build Actions in Jenkins' project configuration. However, that options doesn't allow you to specify the push url or remote to push to.

As I understand it, the Git Publisher settings would push the repo Jenkins' clones into its workspace back into Jenkins' public repo, but I want to push to a different remote, the blessed repository.

Does anyone have any suggestions how I can get Jenkins to push to the blessed repo?

EDIT 0:
I tried putting a Post Step to execute the push command to my blessed repository. This appears to work, in that there are no errors. However no changes are being pushed and the logs show that git thinks everything is up to date:

[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESSFUL 
[INFO]     ------------------------------------------------------------------------ 
[INFO] Total time: 1 minute 7 seconds 
[INFO] Finished at: Fri Nov 18 16:10:50 UTC 2011 
[INFO] Final Memory: 19M/45M 
[INFO] ------------------------------------------------------------------------ 
channel stopped 
[My Project] $ /bin/sh -xe /tmp/hudson5604254372179801803.sh + git push [email protected]:my-project.git --all
Everything up-to-date

I don't know why git thinks there's nothing to push, because there definitely is.

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

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

发布评论

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

评论(2

乖乖公主 2024-12-23 22:31:42

如何使用 Jenkins“仅在构建成功时推送”操作,并在集成存储库上使用提交后或接收后挂钩,以便每当 Jenkins 在成功构建后推送时推送到受祝福的存储库?

How about using the Jenkins "Push Only If Build Succeeds" action, with a post-commit or post-receive hook on the integration repository, to push to the blessed repository whenever Jenkins pushes after a successful build?

简单气质女生网名 2024-12-23 22:31:42

您是否考虑过将 Gerrit 添加到您的工作流程中。更改会推送到 Gerrit,然后您的 CI 运行构建并报告测试。可以对其进行设置,以便在将其合并到您的祝福存储库之前需要其他批准(例如授权代码审查)。 EGit 在他们的开发中使用它,http://egit.eclipse.org/r/ 。还有关于此工作流程的其他讨论,例如 alblue 的博客。

Have you considered adding Gerrit to your workflow. Changes are pushed to Gerrit and then your CI runs a build and reports on your tests. It can be set up so that other approvals (like authorized code reviews) are needed before it is merged into your blessed repo. EGit uses it in their development, http://egit.eclipse.org/r/ . There are other discussions of this workflow as well, like, alblue's blog.

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