I recently updated the configuration of one of my hudson builds. The build history is out of sync. Is there a way to clear my build history?
Please and thank you
Normally if you click the build number/timestamp link (rather than the icon) to view its page, there should be a "Don't keep this build forever" button in the top right, where the "Delete" button normally is.
Jenkins stores the configuration for each job within an eponymous directory in jobs/. The job configuration file is config. xml, the builds are stored in builds/, and the working directory is workspace/.
Make sure you understand what is the disk output of your build - if possible - restrict the output to happen only to the job workspace. Use workspace cleanup plugin to cleanup the workspace as post build step. If the process must write some data to external folders - clean them up manually on post build steps.
Go to . jenkins/Jobs/<YourJobName>/build/ , take backup of this folder(if you need for future use) and delete build folder.
Use the script console (Manage Jenkins > Script Console) and something like this script to bulk delete a job's build history https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/bulkDeleteBuilds.groovy
That script assumes you want to only delete a range of builds. To delete all builds for a given job, use this (tested):
// change this variable to match the name of the job whose builds you want to delete def jobName = "Your Job Name" def job = Jenkins.instance.getItem(jobName) job.getBuilds().each { it.delete() } // uncomment these lines to reset the build number to 1: //job.nextBuildNumber = 1 //job.save()
This answer is for Jenkins
Go to your Jenkins home page → Manage Jenkins → Script Console
Run the following script there. Change copy_folder
to your project name
Code:
def jobName = "copy_folder" def job = Jenkins.instance.getItem(jobName) job.getBuilds().each { it.delete() } job.nextBuildNumber = 1 job.save()
My post
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With