Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I clear my Jenkins/Hudson build history?

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

like image 217
myusuf3 Avatar asked Aug 04 '10 21:08

myusuf3


People also ask

How do I get rid of Jenkins keep this build forever?

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.

Where does Jenkins store build history?

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/.

How do I free up space on Jenkins?

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.

How do I reset my Jenkins build number?

Go to . jenkins/Jobs/<YourJobName>/build/ , take backup of this folder(if you need for future use) and delete build folder.


2 Answers

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() 
like image 69
rjohnston Avatar answered Nov 09 '22 09:11

rjohnston


This answer is for Jenkins

  1. Go to your Jenkins home page → Manage JenkinsScript Console

    Enter image description here

  2. 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

like image 45
Nayana Adassuriya Avatar answered Nov 09 '22 07:11

Nayana Adassuriya