How do I kill a stuck Jenkins build?

Sometimes, Jenkins builds simply get stuck, and aborting them from the job page does not help.

If this is your case, then, you can do something with it:

  • read your build job’s full name and, the build number that you wan to terminate

Jenkins.instance.getItemByFullName("<job_full_name>").getBuildByNumber(<build_number>).finish(hudson.model.Result.ABORTED, new java.io.IOException("Stopping this build without being polite."));

Advertisements