How do I stop builds on agents to prepare for routine Jenkins maintenance?

Article ID:204587984
1 minute readKnowledge base

Issue

  • Besides the “Safe Restart” plugin, is there a way to stop agents from building in cases where you would like to upgrade operations center or controllers?

  • Do I have to stop all the agent nodes one at a time and then bring things up in a controlled manner?

  • Is there a way to stop Jenkins from executing any new jobs?

Resolution

  1. The "Safe Restart" function is actually part of Jenkins core. You can reach it by navigating to JENKINS_LOCATION/safeRestart). This will prevent any new builds from starting and will allow existing builds to reach the safe state and then restart the controller. The "Safe Restart" plugin just adds a button for this.

  2. There is also the "Prepare for Shutdown" functionality available via "Manage Jenkins", also known as "Quiet Down". It will have Jenkins stop taking on new builds but will not trigger the restart.

  3. Finally, CloudBees CI also has a Quiet Start function, which will allow you to restart Jenkins, essentially in the Quiet Down mode (i.e., running but not accepting new builds). Plese refer to CloudBees Quiet Start plugin