We have a TeamCity 7.1 installation that builds all branches from a GitHub repository.
GitHub has a notification hook back to TeamCity to trigger a build on check-in. We also have TeamCity polling GitHub every 120 seconds to check for changes (in case the server was offline when a change was checked in).
Our normal development follows a common pattern:
Everything is working swimmingly (after much searching to get the correct configuration settings) however...
The above process triggers several builds on TeamCity and I'd like to know whether they're all necessary. Typically we'll end up with:
Naturally the first build is the last check-in on the particular branch, and the second build is the pull request, but what is the third build for?
Third build is actually the most valuable βΒ it's the result of pull request auto merge (merge that happens, when you press the button at github).
Your builds seem redundant. The more thrifty way to organize TeamCity builds of feature-branches in git is as follows:
refs/heads/master
branch. 120 seconds poll is quite reasonable here.refs/heads/feature-name
branches. As of my experience, only a few of the feature-branches require 120-seconds polling.TeamCity 7.1 has a very nice feature to autotrigger feature-branches, so step (2) can be setup in a couple of clicks with a branch mask like refs/heads/feature-*
.
There is no meaning in building pull requests since they will be covered by master builds.
Updated answer, in case someone still uses TeamCity π
Since 2018, there is a native Pull Request Build Feature. This is a better solution compared to using branch triggers & filters, since it creates a two-way link between the build and the corresponding PR and frees you from having to add any refs/pull/...
to the VCS Branch Spec.
Still, if you insist on using pull/*/merge
: note that this creates superfluous builds in case the "Require linear history" (=only allow Rebase & Squash merges from PRs) feature is enabled on the GH repo, since a PR in such case can only be merged once it is up-to-date with its base branch anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With