Checkout multiple directories per configuration


I am running Teamcity 4.5 and Subversion 1.4.  I am trying to figure out how to checkout multiple directories during the same run.  Here is my example:

I have 2 projects; ProjectA and ProjectB.
ProjectA depends on ProjectB's source code and binaries.
Their checked out locations are C:\ProjectA and C:\ProjectB and need to be there specifically.

When I run the build for ProjectA in Teamcity, I want it to checkout (or update if the files are already there) ProjectA and ProjectB.  I tried using externals with Subversion but it will only let me do this:  C:\ProjectA\ProjectB

How can I get multiple checkouts to work?  Thanks!

Comment actions Permalink

Hello David,

    bcA = build configuration for projectA
    bcB = build configuration for projectB

  bcA and bcB have specific VCS root settings, each have own sources.

  bcA checkout directory = C:\projectA
  bcB checkout directory = C:\projectB

  You add snapshot dependency from bcA to bcB.
  You add build trigger for bcB to trigger bcA.

  You add VCS triggers both for bcA and bcB.

  I believe this configuration is what you need.

  Kind regards,

Comment actions Permalink

Hello Kir,

Thank you for the response.  Let me add a little more complexity to the situation.  I am running on multiple build agents (all agents can build Project A and Project B).  The issue I've run into is Project A tends to be built on one build agent and Project B built on another and therefore the Project B's source files are not present for Project A to use.

I've actually found a solution for this.  Hopefully this will help some people working with source dependencies on multiple build agents.

For this example, let's assume we are working on ProjectA's configuration (ProjectA depends on ProjectB's source code).

Let's say you have a Subversion repository setup with a base url like this:  http://subversionserver/svn/trunk

ProjectA and ProjectB have paths like this:  http://subversionserver/svn/trunk/ProjectA and http://subversionserver/svn/trunk/ProjectB
ProjectA needs to be checked out to C:\ProjectA and ProjectB needs to be checked out to C:\ProjectB.

Under "Version Control Settings", create two VCS Roots.  One has the URL http://subversionserver/svn/trunk/ProjectA and the other has http://subversionserver/svn/trunk/ProjectB.  Under "Checkout Settings" => "Checkout Directory", make Checkout Directory = C:\

Now "Edit Checkout Rules" for each VCS Root.  Add "+:.=>ProjectA" (no quotes) to ProjectA's VCS Root and "+:.=>ProjectB" (no quotes) to ProjectB's VCS Root.

What this setup does is whenever ProjectA is run, it will automatically checkout ProjectB onto the SAME build agent that ProjectA is run on.  This does not work with mapping dependencies the normal way (snapshot or build triggering or artifact).  It also triggers ProjectA to be run if there are changes to ProjectA OR ProjectB.

The alternate solution is to have one VCS Root with the URL http://subversionserver/svn/trunk
Then Edit Checkout Rules and put two lines in there.  The first is +:./ProjectA=>ProjectA and the second is +:./ProjectB=>ProjectB

All other settings are the same.  I hope this helps out some people!

Comment actions Permalink

The only thing I would suggest with such setup is to avoid using entire C:\ as a checkout directory. If someone mistakenly chooses "clean all files before build" you may lose all of the files on C:\. It would be better to checkout in subdirectory.

Comment actions Permalink

Yes.  I completely agree.  I was using C:\ just as an example.  But you are correct.  That would be a rather lengthy mistake.  


Please sign in to leave a comment.