How to fix : Queued builds get stuck in Jenkins

Many a times, build gets stuck in Jenkins.  We need to  handle queued builds and abort executing builds.

In order to get rid of this traffic jam like issue, we can simply execute below code on Jenkins server machine to abort, kill all pending or queued Jobs:

import hudson.model.*
def queue = Hudson.instance.queue
println "Queue contains ${queue.items.length} items"
queue.clear()
println "Queue cleared"
 
Queued builds get stuck in Jenkins
  src: https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/clearBuildQueue.groovy

Post a Comment

0 Comments