Created
May 31, 2022 11:19
-
-
Save lsferreira42/f76bb67ae8f55da546b237cea83ee4e1 to your computer and use it in GitHub Desktop.
Some script that i found online to stop all jenkins builds at once
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
import jenkins.model.Jenkins | |
def numCancels = 0; | |
Jenkins.instance.getAllItems(Job.class).each{ | |
def job = it | |
for (build in job.builds) { | |
if (build.isBuilding()) { | |
build.doStop() | |
numCancels++ | |
} | |
} | |
} | |
println("${numCancels}"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment