Instagram Widget

How to delete all previous Jenkins build and reset it from GUI

This post is regarding the situation I was currently in. The situation was that in Jenkins I ran a job every hour. After that I had a lot of builds shown in my GUI.




So if you want to delete all previous Jenkins build, let's follow these steps:

1. Go to Jenkins home page 

2. Manage Jenkins

3. Click script console

4. A text box will open enter below script after replacing your project name with project_name

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

Post a Comment

0 Comments