[英]How do I get TeamCity to automatically merge a Git feature branch with master and fail the build in case of merge conflicts?
Our development/release cycle works like this: 我们的开发/发布周期如下所示:
Accepted features are then merged into the master branch by the tester , and will therefore be released during the next release cycle (we deploy the trunk/master code weekly). 然后,测试人员将接受的功能合并到master分支中,因此将在下一个发布周期中发布(我们每周部署中继/主代码)。
We're having frustrations with merge conflicts, because by the time the tester has UAT'ed the feature and discovered that it won't merge cleanly, the developer who worked in it has normally moved on to something else. 我们对合并冲突感到沮丧,因为当测试人员对UAT进行功能化并发现它不会干净地合并时,从事该功能的开发人员通常会转移到其他方面。
We're considering a solution whereby every feature branch is automatically merged, by TeamCity, against the current master branch, and any build resulting in a merge conflict is considered a failed build - this will give us early visibility on problematic merges so we can fix them sooner. 我们正在考虑一个解决方案,其中TeamCity会自动将每个功能分支与当前的主分支合并,并且任何导致合并冲突的构建都将视为失败的构建-这将使我们能够早日了解有问题的合并,以便我们进行修复他们更快。
TeamCity doesn't appear to have built-in support for this workflow (ie when a push happens to branch X, checkout master, merge branch X onto it, build, unit-test, create package). TeamCity似乎没有对此工作流的内置支持(即,当对分支X进行推送,签出母版,将分支X合并到其上,构建,单元测试,创建程序包时)。 Has anyone created a similar workflow using TeamCity and Github - using custom msbuild targets, perhaps?
是否有人使用TeamCity和Github创建了类似的工作流程-也许使用自定义msbuild目标?
EDIT: I should clarify that we're using Github but we're not currently using pull requests - sounds like this is something I should investigate. 编辑:我应该澄清一下,我们正在使用Github,但我们当前未在使用请求请求-听起来这是我应该调查的事情。 :)
:)
If you're using Github and Pull Requests then check out Hadi Hariri's blog post about how to get the pull request after it has been merged with master: 如果您使用的是Github和Pull Requests,请查看Hadi Hariri的博客文章,了解如何在与master合并后如何获取Pull Request:
http://hadihariri.com/2013/02/06/automatically-building-pull-requests-from-github-with-teamcity/ http://hadihariri.com/2013/02/06/automatically-building-pull-requests-from-github-with-teamcity/
Github does an automatic merge for every pull request and the resulting merge is available (though pretty much undocumented) as Github会为每个拉取请求进行自动合并,并且可以使用生成的合并(尽管几乎未记录)为
git fetch origin +refs/pull/298/merge
where pull request id is 298. And so all merged pull requests can be fetched with a wildcard in place of the id in Teamcity and be built automatically. 其中请求请求ID为298。因此,可以使用通配符代替Teamcity中的ID来获取所有合并的请求请求,并自动进行构建。 The branch specification would look like this:
分支规范如下所示:
+refs/pull/*/merge
EDIT: You say you're not using pull requests so I guess you could do this with some git commands. 编辑:您说您没有使用请求请求,所以我想您可以使用一些git命令来做到这一点。 I haven't tried this out myself so these are only a few tips to get you started.
我自己还没有尝试过,所以这些只是帮助您入门的一些提示。
To check for merge conflicts, one of these strategies should work. 要检查合并冲突,应使用以下策略之一。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.