Shared resources are used in Continua CI to restrict the number of builds or stages accessing the same resource concurrently. This can be useful if you wish to limit the number of times a particular tool is run due to a licence or memory limit, or to prevent concurrency issues with multiple build stages simultaneously writing to the same file, folder or network resource.
Each shared resource has an allocation of locks which can be acquired and held by builds or stages. These locks are allocated at server or agent level.
Server Shared Resource locks can be acquired while evaluating configuration conditions and also while selecting an agent. Any builds that require Server Shared Resource locks, which are held by other builds, will wait on the build queue or stage queue until the required locks are released.
Agent Shared Resource locks are allocated per agent and can be acquired when an agent is selected for a stage. Continua CI will chose the agent with the highest available allocation of the required locks. If there are no Agent Shared Resource locks available for any agent, the build will wait on the stage queue until the required locks are released.
Shared resource locks are automatically released at the end of the build or stage which acquired the lock.