Issue
I have tried below things to make wait between parallel job in jenkins using groovy script but its not waiting.
def jobs = [:]
for(int i=1;i<=5;i++)
{
def component = i
jobs[component] =
{
sleep(i) {
echo "Waiting for ${i} seconds"
}
}
}
parallel jobs
am i missing something or its totally wrong i couldn't figure out
Thanks
Solution
All parallel blocks will start in the same time but each one will sleep "i" seconds before the actual logic execution (Echo command will be executed "i" seconds after the "parallel" call).
Please try:
def jobs = [:]
for(int i=1;i<=5;i++)
{
def component = i
jobs[component] =
{
sleep(i)
echo "Waiting for ${i} seconds"
}
}
parallel jobs
sleep
step does not get Closue as parameter...
Answered By - Barel elbaz
Answer Checked By - Marilyn (JavaFixing Volunteer)