21
votes

I am trying to trigger a single teamcity build for a single merge in VCS. The way my CI is laid out is I one branch staging which we merge all of our changes into. Then when we want to deploy to production we merge staging into the master branch in git. 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?

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.

2

2 Answers

30
votes

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.

Essentially Trigger a build on each check-in actually means "only include 1 checkin in each build." 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.

0
votes

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.