Justin
Justin

Reputation: 18176

How to handle shared projects correctly in TeamCity

Let's say I have two "projects" within TeamCity, which are two websites, that each use a shared library that isn't within the svn path of the website. Here is the svn structure to make it more clear:

Website A: svn://root/web/websitea (uses shared library a)

Website B: svn://root/web/websiteb (uses shared library b)

Shared Library A: svn://root/shared/liba

Shared Library B: svn://root/shared/libb

How would I setup a teamcity project for website a? Right now I have it point to the svn://root but that would make it trigger a build even if website b or shared library b was changed, which is not right. What I really need is a way for it to trigger a build only if there is a change in svn://root/web/websitea OR in svn://root/shared/liba.

I tried setting up two vcs roots within the same project which point to the two svn paths above, however there doesn't seem to be a way to set a working directory for each vcs root. For this reason, it ended up just copying the contents of the two svn paths directly into the root of my build directory instead of putting them in the proper places (C:\Build\Web\WebsiteA & C:\Build\Shared\LibA).

Upvotes: 8

Views: 2080

Answers (2)

manojlds
manojlds

Reputation: 301037

In addition to what Eric mentioned, if you need the entire source root to be checked out, but only trigger the build based on particular paths, you can edit the VCS Trigger rules in the Build Triggering section to have something like:

+:web/websitea
+:share/liba

Upvotes: 6

Eric
Eric

Reputation: 466

TeamCity's checkout rules functionality is able to support the setup you're describing. My team uses it to do something similar to what you're trying to do.

First, set up a single SVN Root. The URL of this root would be something like this:

svn://root/

Then set up the following checkout rules.

For Project A:

+:web/websitea=>/web/websitea
+:shared/liba=>/shared/liba

For Project B:

+:web/websiteb=>/web/websiteb
+:shared/libb=>/shared/libb

The TeamCity documentation on checkout rules isn't totally clear about this point, but only the particular paths you have included will be used to trigger builds. This should meet your need to have only changes is websitea and liba trigger its build (and the same for B).

Upvotes: 13

Related Questions