Skip to content

Instantly share code, notes, and snippets.

@rjohnst
Created May 14, 2015 23:44
Show Gist options
  • Select an option

  • Save rjohnst/b7ea4566e2d1d242a2a3 to your computer and use it in GitHub Desktop.

Select an option

Save rjohnst/b7ea4566e2d1d242a2a3 to your computer and use it in GitHub Desktop.

Revisions

  1. rjohnst created this gist May 14, 2015.
    7 changes: 7 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    // 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()