0
votes

We're using teamcity with github enterprise. And we have it set to run on merge requests as well as commits. However, git keeps sending teamcity commit messages for merges that have 0 file changes, which triggers a build.

For example, this will trigger a build:

enter image description here

I've found the documentation here for creating a trigger filter

But I don't see a way to create a filter on the number of updated files.

I think this is what's causing the builds

Triggering a Build on Branch Merge The VCS trigger is fully aware of branches and will trigger a build once a check-in is detected in a branch. When changes are merged / fast-forwarded from one branch to another, strictly speaking there are no actual changes in the code. By default, the VCS trigger behaves in the following way:

 - When merging/fast forwarding of two non-default branches: the changes
   in a build are calculated with regard to previous builds in the same
   branch, so if there is a build on same commit in a different branch,
   the trigger will start a build in another branch pointing to the same
   commit.  
 - If the default branch is one of the branches in the
   merging/fast-forwarding, the changes are always calculated against
   the default branch, if there is a build on same revision in the
   default branch, TeamCity will not run a new build on the same
   revision.

It's worth noting, that builds on branches that haven't been updated will be triggered by a merge in another branch.

1

1 Answers

1
votes

You probably use checkout rules. Otherwise, running a build on a merge commit with 0 files seems an appropriate action: the commit does change the content of the checkout directory and should trigger a build.

If you limit what you checkout via TeamCity checkout rules, TeamCity only displays the merge commit with 0 files if it actually changes the content of the checked out directories (by merging files in the directory), or the commit graph is not fully known to TeamCity, and it potentially can affect the checkout.

If you are not running the latest TeamCity release (10.0.5 as of now), it makes sense to update. If you still get merge commits displayed which are not affecting the checked out files and are not merging commits created before the VCS was configured in TeamCity, it makes sense to report the details to TeamCity support.