Jenkins Workspace Cleanup plugin is a widely used plugin with over 200k installs per month in the past 12 months.
The thing that bothers me is that its "deferred wipeout" functionality is not documented properly. I can only suspect that "deferred" means asynchronous, so that it doesn't block the node/executor, but I'm guessing right now.
Also if it's actually asynchronous and another job is scheduled on the same node and the same workspace, do we have any guarantees that the workspace is properly cleaned up before the new job starts?
The documentation only says:
When deferred wipeout is disabled the old implementation of filesystem content deletion is used. (...)
For developers of (cloud, for instance) it might be useful to be sure deferred wipeout is never selected as a cleanup method.
What does this mean? What are the scenarios in which deferred wipeout should never be used?
Can anyone explain what is the real effect of having this option enabled/disabled, potentially with some use cases?
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.
IMPORTANT: It is safe to remove the workspace for a given Jenkins job as long as the job is not currently running!
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.
The workspace directory is where Jenkins builds your project: it contains the source code Jenkins checks out, plus any files generated by the build itself. This workspace is reused for each successive build.
Deferred wipeout means that deletion takes place asynchronously to your build, that is:
(See source code for details).
For big workspaces, deletion can take very long, so this will reduce your build time.
When running multiple builds of the same job in parallel, Jenkins will automatically select build-specific workspace names (by adding a numeric extension to the workspace directory) -- so there's no interference with asynchronous deletion.
In a cloud environment where you have ephemeral build nodes created and deleted on-demand, you'd potentially destroy nodes which are still running the asynchronous delete operation, so you might prefer to disable the option in such cases.
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