Skip to content

Instantly share code, notes, and snippets.

@pmdroid
Last active May 27, 2016 15:35
Show Gist options
  • Save pmdroid/b840f1da3960d5d6584c to your computer and use it in GitHub Desktop.
Save pmdroid/b840f1da3960d5d6584c to your computer and use it in GitHub Desktop.
remove all jenkins builds
import hudson.model.*
// For each project
for(item in Hudson.instance.items) {
// check that job is not building
if(!item.isBuilding()) {
System.out.println("Deleting all builds of job "+item.name)
for(build in item.getBuilds()){
build.delete()
}
}
else {
System.out.println("Skipping job "+item.name+", currently building")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment