Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop TeamCity from building a pull request when it is viewed or commented?

Currently, my team is using TeamCity to automatically build pull requests from GitHub.

We have a configuration to build all the pull requests. In the version control settings of the config, our branch specification is

+:refs/pull/*/merge

In the "Build Triggers" configuration setting, we have only one trigger with the following trigger rule:

+:root=Pull Requests on our Repository:\***/*\*

"Pull Requests on our Repository" is our VCS root name.

The issues:

  • When someone views a pull request on GitHub website without doing anything else, a build would be triggered in the TeamCity build agent. This is quite annoying, because from time to time, we have multiple build agents building the same pull requests (when multiple people view it).
  • When someone comments on a pull request, a build would also be triggered.

From my perspective, the only time I want TeamCity to start a build is when new commits are pushed to the pull requests.

Is there a way to do it?

like image 204
delpielo Avatar asked Aug 10 '13 08:08

delpielo


2 Answers

Github's refs/pull/*/merge branches are updated every time mergeability of the branch is recalculated, i.e. on every commit to destination (most likely master) branch. They are also updated when pull request is closed and then reopened. Github's support says these branches are not intended for end users use. The only workaround at the moment is to run builds on refs/pull/*/head branches automatically and on refs/pull/*/merge branches manually.

like image 198
neverov Avatar answered Sep 28 '22 01:09

neverov


Do you have TeamCity configured as per this blog post? I then activate the TeamCity service hook in GitHub which takes care of triggering a build in TeamCity whenever there is a push. This seems to do the right thing for me. Or am I missing something?

like image 30
Pedro Pombeiro Avatar answered Sep 28 '22 02:09

Pedro Pombeiro