How to prevent parallel builds per build configuration across multiple Build Agents

Posted by vanslly on Stack Overflow See other posts from Stack Overflow or by vanslly
Published on 2011-02-20T23:14:21Z Indexed on 2011/02/20 23:24 UTC
Read the original article Hit count: 326

I have many build configurations in TeamCity, each servicing a large project. In the past if a build is kicked off the Build Agent could be busy for up to 20min!

In order to improve throughput I installed a second Build Agent on the same machine such that if a build run is kicked off by say Build Agent 1 and it is busy for 20min and someone from another project makes a change then Build Agent 2 can do the build for the other project without needing to wait on the current build run to finish.

All was well until two successive check-ins resulted in both Build Agents running a build for a single build configuration in parallel. Since some resources are shared, IIS directories & databases, I don't want a single build configuration to run on both Build Agents in parallel.

How can I ensure a build isn't triggered if a build is currently running for that build configuration on a different build agent?

One way seems to involve environmental variables and ensuring a 50/50 split by Build Agent in terms of build configuration compatibility, but that seems a little clunky.

© Stack Overflow or respective owner

Related posts about continuous-integration

Related posts about teamcity