I need to clear and clean Jenkins build history: Yesterday – 2 days ago – All builds. How can I do it in Jenkins?
Clear Jenkins build history ( clear build yesterday )
Jenkins
Jenkins
I need to clear and clean Jenkins build history: Yesterday – 2 days ago – All builds. How can I do it in Jenkins?
Best Answer
Delete a Jenkins build via GUI.
Go into the build you want to delete, and click the Delete this build button in the upper right corner.
If you need to clean the Jenkins build history, and reset the build number back to 1, you can run a simple script in Jenkins Script Console. source
Go to Jenkins Script Console.
Go to your Jenkins home page -> Manage Jenkins -> Script Console.
Run this script to clean and reset.
Copy and paste this script to your Console Script text area and change the
"copy_folder"
to the project name that you need to clean the history. Then click the Run button.If you're using multibranch pipeline or folders, the second line of the above script has to be modified like this:
Another way to remove old builds or jobs is from the command-line.
Login to Jenkins command-line.
To remove an entire job and build history remove the job folder, e.g.:
To look at build history:
To remove selected builds then remove the build number directory, e.g.:
Don't forget the last step if removing or editing files under Jenkins.
After removing jobs or builds from file system you need to go to Manage Jenkins in the Jenkins GUI and click Reload Configuration from Disk.
Note: The Jenkins home directory might be in
/var/jenkins_home
or/var/lib/jenkins
or another location.