I have inherited a Jenkins server and need to clear some space. I have set a;
post {
always {
deleteDir()
}
}
on all the jobs. Can I remove old builds safely by deleting the contents of workspace
and jobs
in the $JENKINS_HOME
?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityYes, you can delete the workspaces safely as well as jobs.
The idea of the jobs directory is to allow you to display jobs history, if job history is not important for you then you can delete job directories from there.
You can also use the Workspace Cleaner Plugin in order to delete workspace content before the beginning of a job run.
In addition, you can set a "Post Build Action" in your jobs which is called "Delete workspace when build is done".
You can find more information in this nice blog post.
Maybe it depends on your Jenkins version, but its not safe to remove everything from the jobs directory, as I just learned the hard way this deletes all your jobs after you restart Jenkins.