Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle shared projects correctly in TeamCity

Tags:

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).

like image 246
Justin Avatar asked Jan 02 '11 15:01

Justin


2 Answers

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
like image 43
manojlds Avatar answered Jan 27 '23 23:01

manojlds


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).

like image 120
Eric Avatar answered Jan 28 '23 00:01

Eric