Sometimes our builds fail. If that happens, then the workspace is not cleaned. New builds just create new workspaces, which eats up all HDD space.
Is there a way to clean the workspace after the build has failed?
Right now I have a clean-up step with a condition succeedOrFailed()
, but it works only if the build was cancelled manually. If the build has failed due to a lack of HDD space or because of the timeout -- the clean-up step is not run.
I don't actually need to clean up. If the TFS-agent would just reuse old workspace directories it would have been a fine solution since I have clean:all
in my YAML
. But for some reason it prefers to create new ones.
I guess I can run rm -rf
in cron
, but then I would need to know when nobody uses the build system.