Skip to content

Instantly share code, notes, and snippets.

@rdeutz
Last active July 29, 2017 18:11
Show Gist options
  • Save rdeutz/3d550d09aa7babfca5248a6541e7e009 to your computer and use it in GitHub Desktop.
Save rdeutz/3d550d09aa7babfca5248a6541e7e009 to your computer and use it in GitHub Desktop.
Delete Job Queue in Jenkins
/*** BEGIN META {
"name" : "Clear build queue",
"comment" : "If you accidently trigger a lot of unneeded builds, it is useful to be able to <b>cancel</b> them all",
"parameters" : [],
"core": "1.300",
"authors" : [
{ name : "Niels Harremoes" }
]
} END META**/
import hudson.model.*
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