Wednesday, May 04, 2016

How to clean and reset Jenkins build history

When you working with Jenkins while building your solution, definitely you have to run your project multiple times. It will result to a long Build History list that looks ugly and unnecessary for your production environment.

 If you need to clean this Build History, and reset the build number, you can run a simple script in  Jenkins Script Console. Here are the steps to do so.

1. Go to `Jenkins Script Console`
Go to your Jenkins home page > Manage Jenkins > Script Console


2. Run the script to clean and reset

Copy and paste this script to your Console Script text area and change the "copy_folder" to project name that you need to clean the history. Then click the "Run button".


def jobName = "copy_folder"
def job = Jenkins.instance.getItem(jobName)
job.getBuilds().each { it.delete() }
job.nextBuildNumber = 1
job.save()

Now check your Build History for the particular project, Wow!, it's clean now!

48 comments:

  1. Awesome...worked like a charm!

    ReplyDelete
  2. Script deletes build history for me. But build # reset to 1 not working. Could you please help?

    ReplyDelete
  3. Doesn't work for multibranch pipeline projects. Any advise?

    ReplyDelete
  4. Very Nice it works
    THX !!! ;)

    ReplyDelete
  5. The build starts from previous build number even if its cleared any help on this ? The change is momentary

    ReplyDelete
  6. Nice blog..! I really loved reading through this article. Thanks for sharing such a amazing post with us and keep blogging... best angularjs training institute in chennai | angularjs training in omr | angular 4 training in chennai | angularjs training in chennai

    ReplyDelete
  7. Thank you for the nice article here. Really nice and keep update to explore more gaming tips and ideas...
    AngularJS Training in Bangalore | AngularJS Course Fees | AngularJS 6 - i Digital Academy - AngularJS Training in Bangalore - Learn AngularJS 6 from Expert Real-time Trainers
    at i Digital Academy with Live Projects and Placement Assistance. Book a Free Demo Today.

    ReplyDelete
  8. I think this is one of the most important info for me.And i am glad reading your article. But want to remark on few general things, The site style is good , the articles is really excellent and also check Our Profile for devops training in chennai, devops training videos

    ReplyDelete
  9. Nice to be seeing your site once again, it's been weeks for me. This article which ive been waited for so long. I need this guide to complete my mission inside the school, and it's same issue together along with your essay.

    python training in bangalore

    python training in hyderabad

    python online training

    python training

    python flask training

    python flask online training

    python training in coimbatore


    ReplyDelete
  10. A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article. I am learning a lot from you.
    Java Training in Chennai

    Java Training in Bangalore

    Java Training in Hyderabad

    Java Training
    Java Training in Coimbatore


    ReplyDelete
  11. Nice & Informative Blog !
    If you are looking for the best accounting software that can help you manage your business operations. call us at QuickBooks Customer Service Number 1-855-974-6537.

    ReplyDelete
  12. Thanks for sharing such useful information with us. I hope you will share some more info about your blog. Please Keep sharing. We will also provide Quickbooks Customer Service Phone Number Contact us +18777510742 for instant help.

    ReplyDelete
  13. Very interesting article to read it. I would like to thank you for the efforts you had made for writing this wonderful article. This article inspired me to read more. Keep sharing on updated posts…

    Learn Digital Marketing Course in Bangalore with Live Project Work & Case Studies taught by Ranjan Jena (10Yrs Trainer). 100% Guarantee to Clear Job Interview. You can also check my article..

    SEO Course
    PPC Google Adwords Course
    Social Media Course
    Google Analytics Course
    Adobe Analytics Course
    Graphic Designing Course

    ReplyDelete

  14. Dr. Vivek Galani is a leading expert in skin and hair. At hair transplant clinic in Surat Skin Care, Cosmetic Laser, Hair Transplant & Slimming Center, Dr. Galani offers the most advanced cosmetic and dermatologic care treatments. The clinic uses advanced FUE methods to produce high-quality hair transplants.

    ReplyDelete
  15. Nice post!

    Worried About QuickBooks Error ?Get in touch with QuickBooks expert for instant solution.
    Click Here to know how to fix QuickBooks Error 12152

    Dial on QuickBooks Error Support Number +1-855-977-7463.

    ReplyDelete
  16. Nice Blog !
    At times, while filing form 941, you may face QuickBooks Form 941 Error when the total sum of the tax amount exceeds $2500. To fix such issue, you must contact our experts via QuickBooks Support Number and get permanent ways to solve QuickBooks problems.

    ReplyDelete
  17. Your blog is very nice and has sets of the fantastic piece of information. Thanks for sharing with us. If you face any technical issue or error, visit:

    Quickbooks customer service

    ReplyDelete
  18. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support in this area. same as your blog i found another one Mobile Marketing .Actually I was looking for the same information on internet for Mobile Marketing and came across your blog. I am impressed by the information that you have on this blog. Thanks once more for all the details.

    ReplyDelete
  19. Shreeja Health Care is leading manufacturer of Oil Maker Machine. Shreeja Oil Extraction Machine is able to extract oil from various seeds like peanuts, Coconut, Sesame, Soybean, macadamia nuts, walnuts, sunflower seeds, vegetable seeds flaxseed etc.

    ReplyDelete
  20. Thanks for sharing such useful information with us. I hope you will share some more info about your blog. Please keep sharing. We will also provide QuickBooks Customer Service Number for instant help.

    ReplyDelete
  21. I would like to take this opportunity to thank the author for his incredible work. I believe Customer relationship management is essential for every business to create a loyal customer base. keep doing it. all the best
    Top CRM Software

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
  23. How To Clean And Reset Jenkins Build History ~ Code Ketchup >>>>> Download Now

    >>>>> Download Full

    How To Clean And Reset Jenkins Build History ~ Code Ketchup >>>>> Download LINK

    >>>>> Download Now

    How To Clean And Reset Jenkins Build History ~ Code Ketchup >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete
  24. How To Clean And Reset Jenkins Build History ~ Code Ketchup >>>>> Download Now

    >>>>> Download Full

    How To Clean And Reset Jenkins Build History ~ Code Ketchup >>>>> Download LINK

    >>>>> Download Now

    How To Clean And Reset Jenkins Build History ~ Code Ketchup >>>>> Download Full

    >>>>> Download LINK 3h

    ReplyDelete
  25. Your website is very beautiful or Articles. I love it thank you for sharing for everyone. Africa hemp CBD

    ReplyDelete
  26. Thanks for Sharing This Article. It is very so much valuable content.

    ReplyDelete
  27. wordpress website design agency in united states Need professional WordPress Web Design Services? We're experts in developing attractive mobile-friendly WordPress websites for businesses. Contact us today!

    ReplyDelete
  28. Great share! Thanks for the information. Keep going!

    ReplyDelete
  29. Great share! Thanks for the informatiom. Keep going!

    ReplyDelete
  30. AVEVA System Platform supplier & solutions provider of AVEVA System Platform, quick technical support in India & globally.

    ReplyDelete
  31. "Great article, felt good after reading, worth it.
    i would like to read more from you.
    keep posting more.
    also follow Propmtengineeringcourseinhyderabad"

    ReplyDelete
  32. "Great article, felt good after reading, worth it.
    i would like to read more from you.
    keep posting more.
    also follow Mern Stack course in hyderabad"

    ReplyDelete
  33. This is a helpful post for keeping Jenkins clean and organized! Having a long build history can clutter up the interface and make it hard to find important builds.
    fullstacktrainingcenter

    ReplyDelete
  34. Great and I have a keen supply: What Does A Full House Renovation Cost house renovation plans

    ReplyDelete