与 Subversion 中的多个分支开发持续集成
在我正在进行的项目中,我们使用 SVN 和“稳定主干”策略。这意味着对于发现的每个错误,QA 都会打开一个错误票并将其分配给开发人员。然后,开发人员修复该错误并在分支(主干之外,我们称之为错误分支
)中检查它,并且该分支将仅包含针对该特定的修复>bug Ticket
当我们决定发布时,对于我们想要向客户发布的每个错误修复,开发人员会将多个 bug 分支
中的所有修复合并到 trunk
并继续正常的 QA 周期。
问题是我们使用 trunk
作为 CI 作业的代码库 (Hudson ,具体来说),因此,对于对 bug 分支
的所有提交,它将错过每日构建,直到当我们决定发布新版本时将其合并到 trunk
该软件。显然,这违背了 CI 的目的。
解决这个问题的正确方法是什么?
In the project that I'm working on, we are using SVN with 'Stable Trunk' strategy. What that means is that for each bug that is found, QA opens a bug ticket
and assigns it to a developer. Then, a developer fixes that bug and checks it in a branch (off trunk, let's call this the bug branch
) and that branch will only contain fixes for that particular bug ticket
When we decided to do a release, for each bug fixes that we want to release to the customer, a developer will merge all the fixes from several bug branch
to trunk
and proceed with the normal QA cycle.
The problem is that we use trunk
as the codebase for our CI job (Hudson, specifically), and therefore, for all commits to the bug branch
, it will miss the daily build until it gets merged to trunk
when we decided to release the new version of the software. Obviously, that defeats the purpose of having CI.
What is the proper way to fix this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
正如您所注意到的,使用分支的目的之一是将票务修复和功能开发中的特定代码波动与主干隔离开来。 但是一旦功能或票证完成,您应该将其合并回来。在 Subversion 中,分支更适合用来跟踪相关功能集(例如某个版本的功能集),而不是单个功能。否则,您很快就会遇到无法管理的分支数量。
此外,为什么要延迟整合呢?版本之间等待的时间越长,您的孤立更改与此后所做的另一个更改发生冲突的可能性就越大,并且/或在合并回来后在系统中产生进一步的不稳定。
我的首选策略是这样做:
现在,一旦您准备好发布:
我知道您询问了强制持续集成系统执行此操作的最佳方法。但我谨建议,鉴于 Hudson 被认为是一个相对有能力的 CI 系统,事实上,您在将开发模型硬塞到其中时遇到了很多麻烦,这可能表明这不是一个非常适合 CI 的流程首先。
我们的典型做法是每个项目有两个基础构建:一个针对主干,另一个针对当前发布分支。这样您就知道:
trunk
)As you note, one purpose of using a branch is to segregate specific code fluctuations from ticket-fixing and feature development away from the trunk. But once the feature or ticket is complete, you should merge it back. In Subversion, branches are better used to track sets of related features (like those for a release), not individual features. Otherwise you will quickly wind up with unmanageable numbers of branches.
Furthermore, why delay the integration at all? The longer you wait between releases, the higher the likelihood that your isolated change will conflict with another change made since then and/or produce further instability in your system once merged back.
My preferred strategy is to do something like this:
Now, once you're ready for release:
I know you asked about the best way to coerce your continuous integration system to do this. But I would respectfully suggest that given that Hudson is recognized as a relatively capable CI system, the fact that you're having a lot of trouble shoehorning your development model into it is a possible sign that it's not a process that lends itself well to CI in the first place.
Our typical practice is to have two base builds per project: one against trunk and one against the current release branch. This way you know that:
trunk
)这就是我们所做的(灵感来自多个敏捷团队的版本控制 Henrik Kniberg):
(来源:infoq.com< /a>)
CI 在所有分支(开发分支、主干、发布分支)上运行。
Here is what we do (inspired from Version Control for Multiple Agile Teams by Henrik Kniberg):
(source: infoq.com)
CI runs on all branches (development branches, trunk, release branches).
这听起来很痛苦并且过于复杂(从分支/合并的角度来看)。
我会在发布时分支并让开发人员签入主干。任何需要作为热修复发布的内容都可以与发布分支合并。
That sounds painful and overly complicated (from a branch/merge standpoint).
I would branch at release and have developers check in to the trunk. Anything that needs to go out as a hot fix could be merged with the release branch.
每晚合并到一个“unstable-evil-twin-trunk”,将所有错误分支合并到evil-twin-trunk。
或者在每个 bug 分支上设置夜间构建(听起来像是很多夜间构建)。
在我看来,这听起来像是集中式源代码控制解决方案的大量分支。也许您需要一个分布式版本控制系统和每个工作站上的构建服务器,这似乎可以完成同样的事情(每个开发人员的独立签入和每日构建开发人员签入的内容)
Do a nightly merge to an "unstable-evil-twin-trunk" that merges all bug branches to the evil-twin-trunk.
Or set up nightly builds on each bug-branch (which sounds like a lot of nightly builds).
In my opinion, this sounds like an awful lot of branching for a centralized style source control solution. Maybe you need a distributed version control system and a build server on each workstation, which it seems would accomplish the same thing (isolated check ins for each developer and daily builds on what the developers check in)
与其为错误修复创建分支,不如尝试为错误修复之前的版本创建分支,然后将修复应用到主干。
这样,如果您想为客户提供错误修复,您可以为他们提供主干版本。
如果您不想向他们提供错误修复,您可以在应用修复之前向他们提供分支版本。
这样,您可以让 Hudson 构建干线,并且您的夜间构建将包括所有错误修复。
Instead of creating branches for your bug fixes, why don't you try creating branches for the version before the bug fix, and then apply the fix to the trunk.
This way, if you want to give your customers the bug fix, you give them the trunk version.
If you do not want to give them the bug fix, you can give them the branch version before your fix was applied.
This way, you can have Hudson build the trunk line, and your nightly builds will include all your bug fixes.
我回答了很多这个问题,下面是 IBM 如何使用 ClearCase (UCM) 推荐它,并且我在现实世界中这样做:
任何不以 TAG 为前缀的内容都是分支。
I answer this a lot, and here's how IBM recommends it with ClearCase (UCM), and I do it in the real world:
Anything not prefixed by TAG is a branch.