Skip to content

Instantly share code, notes, and snippets.

@lsferreira42
Created May 31, 2022 11:19
Show Gist options
  • Save lsferreira42/f76bb67ae8f55da546b237cea83ee4e1 to your computer and use it in GitHub Desktop.
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
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