使用 Git 和 Hudson 预先检查 RoR 构建?
在 .NET 项目中,我使用 TeamCity 和 Subversion 来运行预先检查的构建。
对于那些不熟悉预先检查的构建的人来说,这个想法是,当您提交时,构建将使用针对主干的变更集运行。
如果该构建通过,那么您的变更集将应用于主干。如果未通过,您会收到通知并可以重试。
这样,来自主干的构建应该始终是绿色的,并且团队中的其他人不会因构建损坏而中断。
我的问题是:是否有人使用 Git 和 Jenkins(又名 Hudson)在 Ruby on Rails 项目上实现了类似的工作流程?如果是这样,您能否分享一些提示/技巧/文档?
On .NET projects, I've used TeamCity and Subversion to run pre-checked builds.
For those unfamiliar with pre-checked builds, the idea is that when you commit, a build is run with your changeset against trunk.
If that build passes, then your changeset is applied to trunk. If it doesn't pass, you're notified and can try again.
That way, builds from trunk should always be green, and no-one else on the team is interrupted by build breakage.
My question is: has anyone achieved a similar workflow on a Ruby on Rails project, using Git and Jenkins (a.k.a. Hudson)? If so, could you please share some hints / tips / documentation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想看看 Jenkins/Gerrit 组合。 Gerrit 是一个您可以设置的代码审查系统,因此除非您的提交获得批准,否则它不会将您的提交推送到 master。您可以对其进行设置,以便 Jenkins 首先必须批准它。
我们开始将它用于 C++ 项目,其中 Jenkins 首先尝试构建补丁,如果成功,则会将其推送到主存储库。这也不会阻止客户端的 git。
You might want to have a look at a Jenkins/Gerrit combination. Gerrit is a code review system that you can setup so it will not push your commit to master unless your commit is approved. You can set it up so that Jenkins first has to approve it.
We are starting to use it for a C++ project where Jenkins first tries to build the patch, if it succeeds it is pushed to the main repo. This also doesn't stall git on the client side.
要真正做到这一点,您需要使用 Git 预接收挂钩。一个优秀的(在代码推送时运行 PHP 测试)详细信息如下: codeutopia.net 上的一篇博客文章
然而,该条目的最后一句指出:
如果您的测试套件需要几分钟才能运行,那么这就没意思了,而当需要 10 或 20 分钟时,就会非常烦人(因为开发人员机器上的
git
会坐在那里等待,在预接收钩子退出之前不要放开)。现在,您也许可以编写某种 Hudson 脚本来在构建中断时恢复失败的提交。一个前团队尝试过这样的想法,但从未实施。
To truely do this, you want to use a Git pre-receive hook. An excellent one (which runs PHP tests when code has been pushed) is detailed in: a blog post on codeutopia.net
However, the last sentence of the entry states:
Which is no fun if your test suite takes minutes to run, and seriously annoying when it takes 10 or 20 minutes (because
git
on the dev's machine will sit there and wait and not let go until the pre-receive hook exits).Now, you may be able to write some sort of Hudson script to revert the failing commit when a build breaks. A former team experimented with such an idea, but never implemented it.