Interview Prep/Jenkins/Pipeline design & Jenkinsfile decisions

A pipeline runs a 3-hour performance test. If the controller restarts mid-run, the build is lost. How do you make long builds resilient?

AdvancedScenarioPipeline design & Jenkinsfile decisions
Answer

Situation read → Durability, agent survival and step design all matter.

What I'd do →

  1. Use durabilityHint('MAX_SURVIVABILITY') for this pipeline.
  2. Run the test on a static agent or a pod that survives controller restarts (pods are not deleted when the controller restarts; they reconnect if the controller returns within the agent's timeout).
  3. Use plain sh steps (durable tasks) which keep running and writing output to the agent during the restart.
  4. Do maintenance with quiet-down so new long builds do not start before a planned restart.
  5. Better: trigger the perf test in an external system and have Jenkins wait on it, so Jenkins restarts do not matter.

Why → Pipeline resume needs persisted CPS state plus a surviving agent and a durable step.

Interview tip → Explain that sh is durable because output goes to files on the agent, not the channel.

All Jenkins questions Roadmap: Jenkins

More on Pipeline design & Jenkinsfile decisions