Forked from jmarcos-cano/kill-jenkins-stuck-build.groovy
Last active
June 23, 2021 12:57
-
-
Save kronis/d729bab92ed5a7307f64889563dcfc61 to your computer and use it in GitHub Desktop.
Stop & Kill Jenkins stuck build
This file contains 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
// https://jenkins.myhost.com/job/PROJECT1/job/a-repo/job/release%252F6.1/85/console | |
def jobname = "PROJECT1/a-repo/release%252F6.1/" | |
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