I have a job with configuration matrix to perform build on 2 computer (master and slave). I have "Delete workspace before build starts" option checked on this job.
Unfortunately, workspace is delete only on "master" node, that is node where main job (job which launch all the job necessary to cover configuration matrix) is perform.
Workspace on second node is not delete.
I think it's a Jenkins error : because job has configuration matrix, there is a master job to launch other job. So "Delete workspace before build starts" option is apply only for this master job. I think this option should be apply for all matrix configuration job.
Someone know if I wrong ?
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.
There is something locking the file or directory in the workspace. Someone has logged into Jenkins and is accessing the files from the workspace directly using the file system but not via Jenkins. The build process left a zombie program.
Freestyle jobs The plugin provides a build wrapper (Delete workspace before build starts) and a post build step (Delete workspace when build is done). These steps allow you to configure which files will be deleted and in what circumstances. The post build step can also take the build status into account.
There is a way to clean up a workspace in Jenkins. You need to install the Workspace Cleanup Plugin. This plugin can clean up the workspace before build or after a build. Under Build Environment, check the box that says Delete workspace before build starts.
After the investigation I found out that Slaves workspaces are not deleted by "Delete workspace before build starts" method, workspace can be deleted on master only with the method (added by https://wiki.jenkins-ci.org/display/JENKINS/Workspace+Cleanup+Plugin).
The best option in this case is to use the script: https://gist.github.com/rb2k/8372402
Good resource to get additional info regarding Jenkins workspace deletion is: https://julienprog.wordpress.com/2016/04/14/clean-up-jenkins-workspaces/
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