[Jenkins] 强制退出job
首先进入 Jenkins 的 script console 页面:
script console 路径:manage jenkins -> manage nodes -> master -> script console
反正下面的脚本,都可以试一下
# 1
Jenkins.instance.getItemByFullName("JobName") .getBuildByNumber(JobNumber) .finish( hudson.model.Result.ABORTED, new java.io.IOException("Aborting build") );
# 2
Thread .getAllStackTraces() .keySet() .each() { t -> println(t.getName()); }
# 3
Thread .getAllStackTraces() .keySet() .each() { t -> if (t.getName().contains("JobName")) { println(t.getName()); t.stop(); } }
# 4
Thread .getAllStackTraces() .keySet() .each() { t -> if (t.getName().contains("JobName")) { println(t.getName()); t.interrupt(); } }