I have a teamcity pipeline with multiple build configurations. Some of them need a database for testing. As of yet I have a pool of db schemas configured as a shared resource in TeamCity. Each build configuration lock a schema and then deploy DB into it as the first step. Now, I'd like to have a build configuration that would lock a resource, deploy db and then it should be used by other builds in the pipeline.
Something like:
deploy_db -> build_binaries -> unit tests
-> integration tests
-> ... other tests
I'd like to run test builds in parallel. For that I'd need to lock a schema in deploy_db and then pass a lock to other builds. Is it possible?
Perhaps I could lock any value from schema pool in deploy_db and then in other build configs use %dep.deploy_db.locked_schema% to lock a specific value.
However then it is probably possible that build for another branch can trigger deploy_db that could lock the same schema (using "lock any value") ? I mean it's probably possible if it's triggered after deploy_db finish and before next build executes lock? There would be a short period of time when lock is released after deploy_db and before it's acquired again. Technically another build could lock same value in this time. Is it possible to prevent this?
For example can I lock a value in the first build from a pipeline and release it in the last one?