Forked from jmarcos-cano/kill-jenkins-stuck-build.groovy
Created
July 12, 2018 12:17
-
-
Save vutkin/27410b4a844293ee5ee61d59d996b3d1 to your computer and use it in GitHub Desktop.
Stop & Kill Jenkins stuck build
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
def jobname = "the-job-name" | |
def buildnum = 85 | |
def job = Jenkins.instance.getItemByFullName(jobname) | |
for (build in job.builds) { | |
if (buildnum == build.getNumber().toInteger()){ | |
if (build.isBuilding()){ | |
build.doStop(); | |
build.doKill(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment