1

Is there a way in Jenkins to force the build number to start at 199 for example?

Since we have used cruise control for a number of years, I would like the build number is to continue from there if possible.

Ageis
  • 2,221
  • 4
  • 22
  • 34
  • Share your build infor. This may help https://stackoverflow.com/questions/20901791/how-to-reset-build-number-in-jenkins – LifeOfPi Aug 04 '17 at 09:37
  • 2
    Do You need to start all jobs from that number as starting. I think you can use Next Build Number Plugin in jenkins to start the second build from that number. – Chandra Sekhar Y Aug 04 '17 at 10:01
  • 1
    convert that to an answer Chandra Sekhar – Ageis Aug 04 '17 at 11:15

1 Answers1

0

Please see here: https://stackoverflow.com/a/49053851/1662268

resetNumberTarget = 14
item = Jenkins.instance.getItemByFullName("Project Name [from project Dashboard]")
//println(item)

item.builds.each() { build ->
  //println(build)
  //println(build.number)

  if(build.number >= resetNumberTarget)
  {
    //println("About to Delete '" + build + "'")    
    build.delete()  
  }
}

item.updateNextBuildNumber(resetNumberTarget)
Brondahl
  • 7,402
  • 5
  • 45
  • 74