Shimith
Shimith

Reputation: 87

How to reset build numbers from Linux Jenkins master?

I have a Linux Jenkins master and one windows slave. I want all the current projects build numbers to be reset, and next time when I start the build it should start from number 1.

How to do that in Linux master? Please provide me the steps to reset build numbers?

Upvotes: 1

Views: 1286

Answers (1)

Miguel Ortiz
Miguel Ortiz

Reputation: 1482

You could use the groovy script console as explained here.

Go into your master Jenkins instance http://your_jenkins_url/script and run this:

item = Jenkins.instance.getItemByFullName("Your Project Name")
//THIS WILL REMOVE ALL BUILD HISTORY
item.builds.each() { build ->
  build.delete()
}
item.updateNextBuildNumber(1)

I've tested it in my local setup and it worked:

run_groovy_script

Results:

results

Upvotes: 1

Related Questions