Skip to content

Instantly share code, notes, and snippets.

@taikedz
Created January 31, 2022 12:19
Show Gist options
  • Save taikedz/a74db4da44c332809de63a21bb7ebee2 to your computer and use it in GitHub Desktop.
Save taikedz/a74db4da44c332809de63a21bb7ebee2 to your computer and use it in GitHub Desktop.
Kill unkillable Jenkins job

Kill unkillable Groovy job

If a job is running a system groovy script, it cannot be simply "aborted"

You need to go to $jenkins_url/script and run the contents of the attched script, replacing the original job_line content with the path (from URL) of your job

def job_line = "Rootdir/job/Subdir/job/Job_name"
job_line = job_line.replace("/job/", "/")
Thread.getAllStackTraces().keySet().each() {
if (it.name.contains(job_line)) {
println "Stopping $it.name"
it.stop()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment