Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save orenzi-tr/6a0af3f9c7b97dde24088a9c5acdcc80 to your computer and use it in GitHub Desktop.
Save orenzi-tr/6a0af3f9c7b97dde24088a9c5acdcc80 to your computer and use it in GitHub Desktop.
Stop & Kill Jenkins stuck build
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