18

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.

Community
  • 1
  • 1
Llyle
  • 5,980
  • 6
  • 39
  • 56

1 Answers1

28

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

Set it to 1, to fulfil your task.

Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
KIR
  • 5,614
  • 1
  • 31
  • 23
  • 1
    Using the **Deployment** build configuration type seems to set this limit to 1 automatically - which makes a lot of sense :-D – Oliver Jan 11 '19 at 11:10