This Question is Answered

2 "helpful" answers available (2 pts)
7 Replies Last post: Feb 11, 2012 2:12 PM by Pavel Sher  
Carel Lotz Newbie 78 posts since
Jul 28, 2008
Currently Being Moderated

Jun 9, 2011 2:57 PM

How to limit to 1 concurrent build across all available agents

Hi

 

We have some build configurations that can run on any agent, however, only one of these builds should be allowed to run concurrently at any time.  Is this possible to accomplish using the TeamCity configuration?  The "Limit the numer of simultaneously running builds" setting seems to only apply to an individual build configuration.  I want it to apply a whole set of build configurations.

 

Thanks

Pavel Sher JetBrains 2,148 posts since
Mar 6, 2008
Currently Being Moderated
Jun 9, 2011 6:29 PM in response to: Carel Lotz
Re: How to limit to 1 concurrent build across all available agents

It seems you need something like locks. TeamCity Groovy plugin (http://confluence.jetbrains.net/display/TW/Groovy+plug) has ability to emulate read / write locks on per build level. With help of it in your build configurations you can add special property:

system.locks.writeLock.<lockName>

 

with the same lockName. Then if a build is running with this property, any other build requiring this lock will wait.

Pavel Sher JetBrains 2,148 posts since
Mar 6, 2008
Currently Being Moderated
Jun 9, 2011 11:59 PM in response to: Carel Lotz
Re: How to limit to 1 concurrent build across all available agents

No, you do not need to modify your scripts. TeamCity itself (Groovy plugin) will raise lock when build with such property starts and releases it when build finishes.

Pavel Sher JetBrains 2,148 posts since
Mar 6, 2008
Currently Being Moderated
Jun 10, 2011 12:11 AM in response to: Carel Lotz
Re: How to limit to 1 concurrent build across all available agents

Yes, you should add system property system.locks.writeloc.<mylockname> to all configurations requiring exclusive access to resource <mylockname>. Builds of these configurations will wait in queue till lock is released by a build. Other builds of other build configurations won't be affected.

szczepiq szczepiq Newbie 4 posts since
Mar 24, 2010
Currently Being Moderated
Feb 11, 2012 12:42 AM in response to: Pavel Sher
Re: How to limit to 1 concurrent build across all available agents

This sounds good. I recon it will also work if I configure the system property on the project level, right?

Pavel Sher JetBrains 2,148 posts since
Mar 6, 2008
Currently Being Moderated
Feb 11, 2012 2:12 PM in response to: szczepiq szczepiq
Re: How to limit to 1 concurrent build across all available agents

Yes, project level property should work too.

More Like This

  • Retrieving data ...