Forked from realityforge/Delete historic hobs and some workspaces
Last active
July 8, 2019 14:00
-
-
Save arehmandev/c436e1a54118ac3087c5ff2f4b063c19 to your computer and use it in GitHub Desktop.
Kill all queued jenkins jobs and cancel any running jobs
This file contains hidden or 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
Jenkins.instance.getView('All').getBuilds().each { it.delete() } |
This file contains hidden or 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
import hudson.model.* | |
def q = Jenkins.instance.queue | |
// Cancel queued | |
q.items.each { q.cancel(it.task) } | |
// Stop running | |
Jenkins.instance.getView('All').getBuilds().findAll() { it.getResult().equals(null) }.each{ | |
println("Stopping job ${it}") | |
it.doStop() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment