Have you considered to use http://javadoc.jenkins-ci.org/hudson/model/WorkspaceCleanupThread.html? Although I have not used it yet, since I've just found it
You can configure it based on the following properties: hudson.model.WorkspaceCleanupThread.disabled false Don't clean up old workspaces on slave nodes hudson.model.WorkspaceCleanupThread.recurrencePeriodHours 24 1.608 How often workspace cleanup should run, in hours. hudson.model.WorkspaceCleanupThread.retainForDays 30 1.608 Unused workspaces are retained for this many days before qualifying for deletion. Further details: - https://wiki.jenkins-ci.org/display/JENKINS/Features+controlled+by+system+properties - https://groups.google.com/forum/#!topic/jenkinsci-users/kIHiCTOnNtM Cheers On Tuesday, 23 February 2016 17:15:35 UTC, Philippe Cadé wrote: > > Hi, > > I would like to automatically clean the workspace on slaves since our > slaves run out of disk space from time to time. > > I saw that there are plugins to clean a job's workspace before or after > the execution and I've seem this groovy script > <https://gist.github.com/rb2k/8372402> but I'm not really satisfied with > those solutions. I would like to only delete a few of the last used > workspaces that would bring me back within the free disk space threshold > that we've defined. Not delete the whole thing to keep things fast. > > For this I'm thinking about using the last access property on the > workspace, however this doesn't seem to be available from the Jenkins API. > > So I came to the conclusion that a plugin would be the way to do this and > before I start building my own I hope that someone can point to an existing > solution. > > Thanks > Philippe > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/23d8d981-947e-413c-934c-08218e71d561%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
