Skip to content

Instantly share code, notes, and snippets.

@rjohnst
Created May 14, 2015 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjohnst/b7ea4566e2d1d242a2a3 to your computer and use it in GitHub Desktop.
Save rjohnst/b7ea4566e2d1d242a2a3 to your computer and use it in GitHub Desktop.
// change this variable to match the name of the job whose builds you want to delete
def jobName = "Your Job Name"
def job = Jenkins.instance.getItem(jobName)
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