deploymentking
1/10/2019 - 5:32 PM

Reset build number for ALL jobs

Jenkins.instance.getAllItems(Job.class).each{
  println it.fullName
  item = Jenkins.instance.getItemByFullName(it.fullName)
  //THIS WILL REMOVE ALL BUILD HISTORY
  item.builds.each() { build ->
    build.delete()
  }
  item.updateNextBuildNumber(1)
}