How to stop a zombie job on Jenkins without restarting the server (#13277)
This commit is contained in:
parent
f396ff0341
commit
dc5641200e
|
@ -0,0 +1,15 @@
|
|||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('Infinite Loop') {
|
||||
steps {
|
||||
script {
|
||||
while (true) {
|
||||
println 'This is an infinite loop!'
|
||||
Thread.sleep(10000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Jenkins.instance.getItemByFullName("sampleZombieJob")
|
||||
.getBuildByNumber(17)
|
||||
.finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build"));
|
|
@ -0,0 +1,6 @@
|
|||
Thread.getAllStackTraces().keySet().each() {
|
||||
if (it.name.contains('sampleZombieJob')) {
|
||||
println "Stopping $it.name"
|
||||
it.interrupt()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
Thread.getAllStackTraces().keySet().each() {
|
||||
if (it.name.contains('sampleZombieJob')) {
|
||||
println "Stopping $it.name"
|
||||
it.stop()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue