I've noticed this problem as well, it really makes "Prepare for shutdown" quite useless for us because it's tedious to have to hard kill our currently running jobs. The whole idea of "Prepare for shutdown" is to allow us to finish the currently running jobs, not freeze them where they are.
It's worth calling out that this has only happened in a recent upgrade of either Jenkins or one of the Pipeline plugins (Sorry it's vague but I'd estimate a change in the last 1-2 months)
Here is a workflow script to repro:
1. Create and start a job that uses the following code:
node( "testnode" )
{
for( int i = 0; i < 10; i++ )
{
println "Sleep: ${i+1}"
sleep(5)
}
}
2. Activate "Prepare for Shutdown" mode while the job is running.
Expected Result: Job continues to run as it's already midway through execution.
Actual Result: Job freezes
srwalter this might not help you, but if you cancel "Prepare for Shutdown" and then on your job click "Pause/resume" to toggle the job into Paused, then Resumed states, the job will continue. Eg.
Sleep: 3
[Pipeline] sleep
Sleeping for 5 sec
Pausing
Resuming
[Pipeline] echo
Sleep: 4
[Pipeline] sleep
Sleeping for 5 sec
[Pipeline] echo
Sleep: 5
I've noticed this problem as well, it really makes "Prepare for shutdown" quite useless for us because it's tedious to have to hard kill our currently running jobs. The whole idea of "Prepare for shutdown" is to allow us to finish the currently running jobs, not freeze them where they are.
It's worth calling out that this has only happened in a recent upgrade of either Jenkins or one of the Pipeline plugins (Sorry it's vague but I'd estimate a change in the last 1-2 months)
Here is a workflow script to repro:
1. Create and start a job that uses the following code:
2. Activate "Prepare for Shutdown" mode while the job is running.
Expected Result: Job continues to run as it's already midway through execution.
Actual Result: Job freezes
srwalter this might not help you, but if you cancel "Prepare for Shutdown" and then on your job click "Pause/resume" to toggle the job into Paused, then Resumed states, the job will continue. Eg.