I do not think it is as easy as that. There are several fundamental
problems that prevent us to implement what Michael suggests.
- There is no easy way to map workspace directory to Job(s) that used
that, much less about the build. (Unless we want to traverse all builds).
- There is no guarantee that $REMOTE_FS_ROOT/workspace/XXX is actually a
Jenkins build workspace. I remember people reporting they store some
other stuff there so we can not purge what we can not prove is a Jenkins
build's workspace (without breaking their experience).
There is a lot of heuristics to implement if we address those:
- If all jobs that used workspace directory in the past are deleted the
WSs can go immediately. (Current implementation can not prove the
directory belongs to a job so it leaves it there IIRC)
- If the system is running out of space, oldest workspaces that does not
host running build can go.
- If we claim that everything in $REMOTE_FS_ROOT/workspace/ belongs to
Jenkins we can remove any clutter create by other tools or jobs
accessing $WORKSPACE/.. accidentally (as people use to put it).
- ...
Otherwise, we are doomed to deal with the clutter on slaves.
--
oliver