How to monitor Git multiple repos for changes without checking out all of them?

Here's my situation: I have a build configuration for a project that relies on several different Git repositories; the build pulls code from all of them and compiles all of them as part of a single job.  One of the repositories is the "main" repository, which has a config file that defines all of the other repos to pull code from and where they're placed at in the build space.  When the build actually runs, the build system used for the project automatically clones or updates all of the involved repositories before compilation starts.

So, I want to be able to trigger a build any time files change in any of the repositories, but I only need TeamCity to pull one of them, since the build script pulls the rest of them.  It doesn't hurt anything to have both TC and the build script pull them, but it does significantly slow down build time; there are enough repos that it can take close to a minute just to run "git pull" on all of them even if nothing has actually changed.

I've figured out a workaround already; I can set the VCS Checkout Mode in the build config to "Do not check out files automatically", which will cause it to monitor all of them for changes but not check them out, so I can handle the checkout as a step in my build script.  This is pretty kludgey and I would rather be able to tell TC to monitor all of them but only check out one of them, though.

I've also tried setting individual checkout rules on the repos to "-:.", so TC won't check out any of the files in them, but that seems to make TC also not monitor any of those files for changes.

Is there a better way to do this that I'm missing, or should I make a feature request?

Comment actions Permalink

Hi, why don't just let TC to pull the code from all repos?

Comment actions Permalink

That's possible, but this results in an extra "git pull" being run on every repository during the build, which slows down builds considerably.

We're using ROS ( as a framework for our projects; ROS has its own build system that is based around the concept of a "workspace" which pulls and builds code from many different repositories at once.  It isn't unreasonable to have a project that uses code from 30 different repositories at once.  There is a single repository that contains a workspace file which defines all of the other repositories that are used, and the ROS tool that initializes a workspace automatically clones all of the other repositories or updates them.  So, we could have TeamCity clone all of the repositories, but during the build process, the ROS build system would just update all of them again.  It would be nice to be able to monitor all of the repositories without having the redundant updates.

Comment actions Permalink

You can create a new build configuration called, for example, Trigger that have all necessary VCS roots attached and attach you BC to trigger as a snapshot dependency, so Trigger depends on your BC.

In Trigger you need to add a VCS trigger and manual (i.e. no) checkout, so any time Trigger is triggered, you BC is triggered as well.


Please sign in to leave a comment.