Safely delete the contents of 'workspace' and 'jobs' in Jenkins

Solution 1:

Yes, 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.

Solution 2:

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.

Tags:

Jenkins