Multiple VCS Roots for Same Build Configuration

We are using a private GitHub Organization as version control. When a task is assigned to a developer, they fork the primary repository, make their code changes, and submit a pull request to have the changes merged into the master branch of the primary repository.

We are also using TeamCity for CI. It is currently configured to kick off a build for a VCS commit, which builds, tests, and deploys the artifact to an artifact repository internally. To accomplish this, the Team City build configuration has multiple VCS roots installed; one for the primary and 1 for each developer's fork.

The problem is that Team City pulls from all of them when a commit is made assuming they are all necessary for the build instead of allowing you to only pull from the single repository that triggered the build.

Based on my research and experimentation it appears that there isn't a good way around this and the only solution is to create a new Build Configuration for each VCS root (using templates for organization and ease of maintenance).  

Question: is there a best practice for the above scenario and if not is it possible to create a plugin to only pull from the triggered VCS root (or at least put this information in an environment variable for use in a script)?  I looked over the custom trigger plugin details, but this only appears to cover triggering, not what is pulled.

1 comment
Comment actions Permalink

Hi Matt,

All attached VCS roots are checked out when the build is started. This behavior is by design.
You can attach primary VCS root to the build configuration and configure TeamCity to automatically build pull requests to this repository. Please see the related blog post: https://blog.jetbrains.com/teamcity/2013/02/automatically-building-pull-requests-from-github-with-teamcity/. Will this approach work in your case?

0

Please sign in to leave a comment.