简体   繁体   English

如何为多个提交触发一个TeamCity构建,但是一个合并到一个分支中

[英]How to trigger one TeamCity build for multiple commits but one merge into a branch

I am trying to trigger a single teamcity build for a single merge in VCS. 我试图在VCS中为单个合并触发单个teamcity构建。 The way my CI is laid out is I one branch staging which we merge all of our changes into. 我的CI的布局方式是我的一个分支暂存,我们将所有的更改合并到一起。 Then when we want to deploy to production we merge staging into the master branch in git. 然后,当我们想要部署到生产时,我们将staging合并到git中的master分支中。 Unfortunately this triggers a lot of builds, one for probably every checkin to the staging branch. 不幸的是,这触发了很多构建,可能是每个签入分段的一个。 So instead we would want that to be a single build. 所以相反,我们希望这是一个单一的构建。 Because it was a single merge into the master branch. 因为它是单个合并到主分支。

So, does anyone know how to trigger a single build on a change in VCS no matter how many check-ins from how many different people were made? 那么,有没有人知道如何触发VCS更改的单一构建,无论从多少不同的人制作了多少签到?

The options I have selected in the build triggers in team city are the following. 我在团队城市的构建触发器中选择的选项如下。

 Trigger a build on each check-in
 Include several check-ins in a build if they are from the same committer

I think I could do it with a custom build trigger but I would rather not go down that path. 我想我可以使用自定义构建触发器来完成它,但我宁愿不去那条路。

Thanks in advance for the help. 在此先感谢您的帮助。

As counterintuitive as it is, unchecking the Trigger a build on each check-in checkbox should solve this issue as long as you have Quiet Period enabled for long enough that all of the checkins are included. 尽管违反直觉,但只要您启用Quiet Period足够长的时间以便包含所有Trigger a build on each check-in ,取消选中Trigger a build on each check-in复选框Trigger a build on each check-inTrigger a build on each check-in可以解决此问题。

Essentially Trigger a build on each check-in actually means "only include 1 checkin in each build." 基本上Trigger a build on each check-in签入的构建实际上意味着“每个构建中只包含1个签入”。 Disabling the option will still cause builds to be triggered by checkins, but will include all checkins (from all users) that occur before the build actually starts. 禁用该选项仍将导致由签入触发构建,但将包括在构建实际开始之前发生的所有签入(来自所有用户)。 TeamCity should really clarify this in their documentation or rename the option. TeamCity应该在他们的文档中明确说明这一点或重命名该选项。

You need to use or override the Quiet Period instead for the branch that's handling the staging merges. 您需要使用或覆盖静默期,而不是处理登台合并的分支。

I'm guessing that in order to specify the quiet period for only that branch, you'll probably need a separate build config. 我猜测,为了只为那个分支指定静默期,你可能需要一个单独的构建配置。 Take your main build config and on any screen where you're administering it, you should see a button on the right to "Extract Template." 拿你的主构建配置,在你管理它的任何屏幕上,你应该看到右侧的“提取模板”按钮。

You can then use that template to create another build config for your staging branch, and override the quiet period on the trigger for it. 然后,您可以使用该模板为暂存分支创建另一个构建配置,并覆盖触发器上的静默期。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM