Hi Guys,
The solution you provided us here in Locking shared resources based on a combination of the selected agent and the job type?, this has been working successfully for us for a couple of years now! Thank so much for that!
I have a question about extending the logic, but before I ask it - let me recap / summarize our current solution described in this current thread:
We hold a server scoped shared resources quota list per each of our configuration types.
The labels in these quota lists are our actual agent hostnames, each with a quota of 1.
Our configurations have a condition to acquire a read lock:
- Acquire any: read lock for ââServer.MyNameSpace.QuotaListForTypeAJobsâ,âQuota listââ
And the (only) stage in our configurations has the following agent requirement:
$Build.SharedResources.Server.MyNameSpace.QuotaListForTypeAJobs.Labels.Any(Equals,$Agent.Hostname$)$
This achieves what we originally wanted:
Allow agents to run concurrent builds, but only 1 build of a specific type at the same time on the same agent.
My question is:
Can we somehow extend this logic to allow more than 1 agent pool (Quota list of agent hostnames) for a configuration? a default one, and others we can manually select before launching the configuration (based on a configuration variable value?)
If I understand correctly this is not possible because shared resource are acquired by selecting the shared resource to acquire from,
but perhaps if we use a complex acquire expression we can artificially âsplitâ the labels in a quota list to artificial groups?
e.g.
acquire expression (pseudo code)
if %AgentPool%=A then acquire 1 label randomly from âLabel_A, Label_Bâ;
if %AgentPool%=B then acquire 1 label randomly from âLabel_C, Label_Dâ;
Do you think something like that could be possible or can you think of a different way to achieve this?
Thanks,
Arik