jenkins job停止

无法取消 multijob

转到 “管理Jenkins” —> “脚本控制台” 并运行如下脚本,只需指定JobName和JobNumber即可:

Jenkins .instance.getItemByFullName("JobName")
       .getBuildByNumber(JobNumber)
       .finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build"));
 

对于一些僵尸build,无法通过手动点击kill build,该如何处理?

"Manage Jenkins" > "Script Console"

def build = Jenkins.instance.getItemByFullName("xxxxx").getBuildByNumber(26522)

build.doStop()

build.doKill()

强制杀除线程

Thread.getAllStackTraces().keySet().each() {

    if (it.name.contains('xxxxx')) { 

      println "Stopping $it.name"

      it.stop()

    }

}

你可能感兴趣的:(jenkins,运维)