I am deploying jenkins in kubernetes using this helm chart:
I have lots of projects using the multibranch pipeline job and see a lot of folders on the controller node in this folder:
/var/jenkins_home/workspace
How do I enable automatic cleanup/retention on those folders?
I have looked at:
but from what I can see thats for the workspace on the agents - which does not really make much sense in kubernetes because the disappear anyway when the pipeline/job terminates.
See Jenkins Features Controlled with System Properties
But I’m not sure if this will cleanup workspace on the controller as well. If not you would need to write a system groovy script run inside a freestyle job that does the same thing.
Are you using your main controller as an agent? Then cleaning up agents make sense.
Otherwise what is in that folder? I don’t know why a controller would have workspace.
Maybe its because the multibranch pipeline job can needs to run on master and it needs a clone of each job per branch in the workspace on the controller node to see if a new branch is available?