I have a Jenkins pipeline which has multiple stages, for example:
node(\"nodename\") { stage(\"Checkout\") { git .... } stage(\"Check Preconditions
You can go to the script console of Jenkins and run the following to abort a hung / any Jenkins job build/run:
Jenkins .instance.getItemByFullName("JobName") .getBuildByNumber(JobNumber) .finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build"));