Abort / Kill multiple pending Jenkins Jobs using Groovy

 Simple execute below code on Jenkins server machine to Abort / Kill all Pending / Queued Jobs:

import hudson.model.*
def queue = Hudson.instance.queue
println "Queue contains ${queue.items.length} items"
queue.clear()
println "Queue cleared"

 
src: https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/clearBuildQueue.groovy

Comments