I really enjoy using the Shared Resources build feature. The "custom values" lock type allows me to have a pool of database servers that my builds can use. I am running against a limitation with how locks are assigned, though. The lock is assigned to a specific build. When that build finishes, the lock is released and any other build can then acquire the lock. However, I have a chain of build dependencies, and multiple builds in the chain require the same lock. I'd like to see the first build in the chain acquire the lock and hold the lock until the last build in the chain. That way, all the builds in the chain will use the same database resource and, more importantly, other build chains will not be able to be assigned to that database until the first chain completes.
The figure below illustrates what I mean. In this example build chain, I have a number of builds that form a dependency chain. The light coloured boxes don't require shared resource locks, but the dark coloured ones do. Ideally, a lock would be acquired at the start of the "apply database scripts" step and would be held until "restore database backup" completes. TAll three builds that require the database will use the same one. Also, if the "run unit tests" step takes a long time, no other build can sneak in and take this database for their own purposes.
This feature would be super helpful to us. Has anyone had experience trying to duplicate this kind of behavior in TeamCity?