I have a TeamCity project with a few types of build configurations:
- Application packages, containing various application components and built from various subtrees in version control
- Role packages, combining the application packages together in different configurations (app server role has common code + front end, web services role has common code + back end, etc.)
- Regression test, a series of build steps that deploy the role packages on corresponding test servers and run a lengthy Selenium test suite
The goal is for the application packages to be built frequently so we know immediately when a unit test has broken, the role packages to be built as needed, and the regression test to run as often as possible when there are new role packages to test. But since the regression test takes a long time and only one regression can run at a time (it monopolizes the set of test servers), we always want it to pick up the newest available packages at the time it starts running. For example:
3:00 code checked in 3:01 build app package (A1) 3:02 app package A1 finishes 3:02 build role package (R1) 3:03 role package R1 finishes 3:04 regression starts for R1 3:10 code checked in 3:11 build app package (A2) 3:12 app package A2 finishes 3:12 build role package (R2) 3:13 role package R2 finishes 3:20 code checked in 3:21 build app package (A3) 3:22 app package A3 finishes 3:22 build role package (R3) 3:23 role package R3 finishes 3:30 regression finishes for R1 ** regression never runs for R2 ** 3:30 regression starts for R3
So far, I've implemented this using artifact dependencies and build triggers:
- Application packages are triggered by a Schedule Trigger, restricted to the relevant source code with VCS trigger rules. They have no TeamCity dependencies.
- Role packages are triggered by Finish Build Triggers pointing to all the relevant application packages. Each one has artifact dependencies on the relevant application packages (last successful build).
- Regression test is triggered by Finish Build Triggers pointing to all the role packages, and restricted to run on a single agent. It has artifact dependencies on all the role packages.
This works well enough when only a single role is rebuilt. But when more than one role changes at the same time, the regression test starts running as soon as the first role is rebuilt, and then the rest of the roles don't get picked up until that test finishes. I want the regression to start running when the last changed role is rebuilt. (Note: there are more roles than agents, and the regression runs on a different agent from the package builds.)
Snapshot dependencies sound like the tool I need... but my understanding is they force all dependent configurations to run from the same VCS revision, and I want to avoid forcing a package to be rebuilt if its code hasn't changed. If the only change today is in a package that only affects role R, then roles S/T/U shouldn't be rebuilt and neither should their dependencies. Is this possible?
Edit: I'm running TeamCity 7.1.1.