The way I have TeamCity set up is as follows. I have two build projects that I'll call Build A and Build B.

Build A is the compile and deploy process, and takes approx. 5 minutes to run. Build B is the running of the unit tests, which runs on a different agent and takes approx. 20 minutes to run.

Build A is triggered from source control, and build B has a "Build Triggering" dependency on Build A. Build B has also been set up as a Snapshot dependency on Build A (although I'm not certain if this is required - is it?).

What happens is that when someone checks in to source control, Build A runs, completes, and then Build B starts running. However, while B is running, if someone was to check in to source control, build A would start again, and can potentially break Build B.

Essentially, I need Build A to block while Build B is running.

What is the best way to go about this?

Thanks,

Andrew

Votes

0

Share

Take a look at Groovy plugin: http://www.jetbrains.net/confluence/display/TW/Groovy+plugIt supports read/write locks, i.e. you can take same write lock in Build A and Build B, in this case only one build of them will be running.As for snapshot dependency - it is only required if both Build A and Build B should use the same souces (sources taken on the same moment of time).