How to reset build number in jenkins

0 votes

Hi Team,

I have one Job in Jenkins. Every time I run the Job, I am getting one new build number. How can I reset the build number in Jenkins?

Oct 25, 2020 in Jenkins by akhtar
• 38,260 points
5,586 views

1 answer to this question.

0 votes

Hi@akhtar,

You can do this task with the groovy script. You need to go to your script Window and enter the below code.

item = Jenkins.instance.getItemByFullName("your-job-name-here")
item.builds.each() { build ->
  build.delete()
}
item.updateNextBuildNumber(1)
answered Oct 25, 2020 by MD
• 95,460 points

Related Questions In Jenkins

0 votes
2 answers

How to disable or reset security settings in Jenkins?

In your local jenkins folder cat  /var/lib/jenkins/secrets/initialauthenticationpassword ...READ MORE

answered Feb 22, 2021 in Jenkins by srini

edited Mar 5 21,220 views
0 votes
2 answers

how to execute a shell script post build step in Jenkins?

You could use the Post Build Task Plugin ...READ MORE

answered Jul 31, 2019 in Jenkins by Sirajul
• 59,230 points
29,895 views
0 votes
1 answer

How to fix a broken build for my project in jenkins?

The user needs to open the console ...READ MORE

answered Oct 11, 2019 in Jenkins by Sirajul
• 59,230 points
8,968 views
0 votes
1 answer

In Jenkins, actual build period time 30 mins. How to reduce the time 20 min??

If the question is how to improve ...READ MORE

answered Jul 13, 2021 in Jenkins by Manisha Naidu

edited Mar 5 3,989 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,248 views
+2 votes
1 answer
+1 vote
3 answers

How to auto build a job in jenkins if there is any change in code on Github repository?

To automatically run build on code commit, follow ...READ MORE

answered Jul 31, 2019 in Jenkins by Sirajul
• 59,230 points
79,615 views
0 votes
1 answer

How to build specific tag in Jenkins?

Hi@akhtar, You may able to do that by using ...READ MORE

answered Dec 8, 2020 in Jenkins by MD
• 95,460 points
4,303 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP