Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 707
Llyle Avatar asked Feb 20 '11 23:02

Llyle


1 Answers

You can "Limit the number of simultaneously running builds" for a build configuration (general settings page).

Set it to 1, to fulfil your task.

like image 150
KIR Avatar answered Oct 06 '22 23:10

KIR