Created
February 1, 2018 14:03
-
-
Save tomcbe/c4e9abbb7265e96f4c345425422e8412 to your computer and use it in GitHub Desktop.
Disable all Jenkins jobs on an instance and clear the build queue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disable all the Jenkins jobs | |
import hudson.model.* | |
for(item in Hudson.instance.items) { | |
println("Disabled job: " + item.name + '\n') | |
item.disabled=true | |
item.save() | |
} | |
def queue = Hudson.instance.queue | |
println "Queue contains ${queue.items.length} items" | |
queue.clear() | |
println "Queue cleared" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment