Skip to content

Instantly share code, notes, and snippets.

@jmarcos-cano
Created August 6, 2017 03:58
Show Gist options
  • Save jmarcos-cano/e203c04ca2a4e4868c1df124e45328a9 to your computer and use it in GitHub Desktop.
Save jmarcos-cano/e203c04ca2a4e4868c1df124e45328a9 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();
}
}
}
@orenzi-tr
Copy link

Great script helped me with my Developer collage that talks really fast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment