Simple scenario
Let's say I have a Jenkins job that uses 4 agents. In Jenkins, I have set up 10 agents. All the agents are identical, and they all carry the label "generic-agent". The Jenkins job treats them all the same as well, using the same label. The various agents don't necessarily finish their tasks all at the same time. I really don't want job #3 starting until there are a total of 4 available agents ready. If job #3 starts with just the 2 remaining agents, it will perform part of its tasks, but then wait for another 2 agents to become available. In this way, jobs 3, 4, 5, etc, will start to become staggered, and it will be hard to keep track of what jobs are really active vs waiting for resources, and how long a pipeline really takes to finish.
How can I tell jenkins to only start a job if 4 agents are completely available?
More complex scenario.
I have a jenkins job that uses 4 agents, but now they are differentiated. One stage uses an agent with the label "super-agent", while the other 3 stages use agents with the label "regular-agent". In my nodes, I have 2 super-agents and 8 regular-agents. How can I tell jenkins not to start the job until there is a complete group of 1 super-agent and 3 regular-agents available?