You want to prevent any jobs from running after Jenkins starts up. This could be necessary to troubleshoot or help recover from a performance issue, or to validate an upgrade or configuration change before releasing a master for regular use.
- CloudBees CI (CloudBees Core)
- CloudBees CI (CloudBees Core) on modern cloud platforms - Managed controller
- CloudBees CI (CloudBees Core) on modern cloud platforms - Operations Center
- CloudBees CI (CloudBees Core) on traditional platforms - Client controller
- CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
- CloudBees Jenkins Enterprise
- CloudBees Jenkins Enterprise - Managed controller
- CloudBees Jenkins Enterprise - Operations Center
- CloudBees Jenkins Platform - Client controller
- CloudBees Jenkins Platform - Operations Center
- CloudBees Jenkins Distribution
- CloudBees Jenkins X Distribution
- Jenkins LTS
Any builds that are in the pending queue when Jenkins is restarted will remain in the queue and potentially be started after Jenkins finishes loading. In addition, scheduled jobs or jobs triggered externally could also start at any time. In order to prevent Jenkins from executing any jobs, you need to put it in “quiet down” mode when it starts up. There are two ways you can do this.
- You can install and use the Quiet Start plugin. This will give you a UI option to restart Jenkins and have it be in “quiet down” mode when it starts up. This plugin is only available to users of CloudBees Core, CloudBees Jenkins Enterprise, and CloudBees Jenkins Platform.
- You can create a Groovy init script that will put Jenkins in “quiet down” mode when it starts. This solution may be required if you are suffering from a performance issue and cannot access the Jenkins UI. It is also the only solution that will work for users of Jenkins LTS or CloudBees Jenkins Distribution. Create a file named
quiet-start.groovyand place it in the
$JENKINS_HOME/init.groovy.d/directory. You may have to create this directory if it does not already exist. The file should contain the following:
import jenkins.model.Jenkins // Go into quiet mode Jenkins.instance.doQuietDown()
Regardless of the solution you use, when Jenkins starts up you will see a red banner at the top of the page which says, “Jenkins is going to shut down,” along with a similar message in the Build Queue. There will be a ‘Cancel’ button which an administrator can click to cancel “quiet down” mode and allow builds to resume.
After Jenkins has started, you may find that you want to purge all builds in the build queue. To do this, you can easily do so by following our How can I purge/clean the build queue? article.