Preventing builds agents from clobbering one another

I need  help configuring TeamCity to work around a problem I'm seeing:

We have 4 projects, each with several build plans.  The build plans essentially create a chain of steps (i.e. build pipeline) for each project, including update dependencies, run unit tests, run js tests, and deploy to acceptance (some projects have more).  We have 3 build agents configured and each of them can handle any of the projects.

Every now and then, when two commits occur close together but aren't picked up in one batch, our unit tests plan (which is the longest running) is run by two build agents simultaneously.  This results in a failure because that build plan requires exclusive access to the database.

How can I configure TeamCity only run one build plan for a project at a time?  Conceptually, I want the entire build pipeline for a project to finish before it's starts again for the next commit.

I rather not assign projects to specific agents because a) we have more projects than agents and b) I want builds to start as quickly as possible.


1 comment
Comment actions Permalink

Hello Christian,

You can limit the number of simultaneously running builds on General Settings page of build configuration. If you set option "Limit the number of simultaneously running builds" to 1 the second build will be queued but not run until the first completes.

Kind regards,


Please sign in to leave a comment.