How to Launch an Agent for Each Parallel Step in a Job

Hello! I just have setup a new Jenkins system on Kubernetes using the official Helm chart. We also have it configured to launch an agent when a new job is executed. Once the job is done that agent runs for another 10 minutes. If no other job needs that agent it shuts itself down after that.

What I would like to do is configure some of our parallel pipelines to launch a single agent for each parallel step in a pipeline. So if a pipeline has 3 parallel steps and no agents are currently running the job would launch 3 separate agents, one for each step.

Is it possible to configure a pipeline to work like that?

Under the condition that you put the node step where you request an agent inside the parallel stages, that is easily possible with scripted pipeline.

Thank you @mawinter69 ! It turns out that the agents I was using before didn’t have enough RAM. Once I resized them in the Helm chart I got the results I wanted.