Most developers with an interest in open source software these days have seen the Github interface for handling pull requests, and relatedly, Travis CI’s support for pull requests. And so we thought it’d be useful to have something similar for our internal CI system.
So, Github has the rather nice (albeit poorly advertised) feature that whenever a pull request is raised, they add a reference for both the HEAD revision of the remote branch, and a commit which merges said HEAD revision into master. For example:
: ceri@misssplendid; git ls-remote origin | fgrep pull
Now, it’s possible to Configure git to fetch pull requests so you can check them out locally, but we can use this same trick to configure Teamcity (or another build CI system) to build and test our pull request applied to master.
Assuming that we already have a configuration to build the master branch of a project, then under “Version Control Settings”, and within the appropriate “VCS root”, add the following to the “Branch Specification” field:
Once that’s saved, Teamcity will start polling all references for merged pull requests from github. Then the next time someone pushes to a branch referenced by a pull request, then it should show up as a branch under the build in Teamcity and (if configured to do so) be automatically built.
We haven’t gotten around to shaving the Github commit status API integration Yak just yet, but we’d love to hear if anyone has.