This guide demonstrates modifying a Jenkins Pipeline to handle controller failures and resume from checkpoints.
A controller restart typically disrupts Freestyle jobs, but Jenkins Pipelines are checkpointed and can resume after a reboot. In this guide, you’ll modify a simple “Hello World” Pipeline to include a long-running loop, then simulate a controller failure mid-build and observe Jenkins resume from the last checkpoint.
After a few seconds, refresh the Console Output for your running job:
You should see Jenkins resume:
Copy
Ask AI
Resuming build at Mon Aug 19 18:00:22 UTC 2024 after Jenkins restartNo need to sleep any longerReady to run at Mon Aug 19 18:00:23 UTC 2024[Pipeline] sleepSleeping for 1 sec[Pipeline] echo39...[Pipeline] echo60[Pipeline] sleepSleeping for 1 sec[Pipeline] sh+ mvn test[INFO] --- surefire:3.2.5:test (default-test) @ hello-demo ---
The build continues from the last checkpoint and completes successfully.
Jenkins Pipelines are designed for resilience. By checkpointing the pipeline state, Jenkins can survive controller restarts and resume where it left off. Use this feature for long-running stages, or disable it when an immediate abort is required on controller failure.