Last active
October 3, 2024 07:58
-
-
Save sytsereitsma/1b370c558a4a34dfe014 to your computer and use it in GitHub Desktop.
[Jenkins] Clear build queue and cancel all builds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def q = Jenkins.instance.queue | |
q.items.findAll { q.cancel(it.task) } | |
//q.items.findAll { it.task.name.startsWith('my') }.each { q.cancel(it.task) } | |
def items = Jenkins.instance.items | |
items.each { job -> | |
job.builds.findAll { build -> build.building }.each { run -> | |
println("Aborting: " + job.name) | |
run.doStop(); | |
} | |
} | |
println("Done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment