Skip to content

Instantly share code, notes, and snippets.

@TheDauthi
Created October 7, 2019 03:30
Show Gist options
  • Save TheDauthi/b291f6e0a8347b83ee76f33ed5e02cce to your computer and use it in GitHub Desktop.
Save TheDauthi/b291f6e0a8347b83ee76f33ed5e02cce to your computer and use it in GitHub Desktop.
Remove all jenkins builds
jobs = Jenkins.instance.getAllItems(AbstractProject.class).collect {it -> Jenkins.instance.getItemByFullName(it.fullName) }
for(job in jobs) {
job.getBuilds().each { it.delete() }
job.nextBuildNumber = 1
job.save()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment