Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "deferred wipeout" option really mean in Jenkins Workspace Cleanup plugin?

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?

like image 241
Adam Romanek Avatar asked Sep 01 '20 08:09

Adam Romanek


People also ask

What does wipe out current workspace in Jenkins do?

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.

Is it safe to clean Jenkins workspace?

IMPORTANT: It is safe to remove the workspace for a given Jenkins job as long as the job is not currently running!

How do I clean up my Jenkins workspace?

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.

What is a workspace in Jenkins?

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.


1 Answers

Deferred wipeout means that deletion takes place asynchronously to your build, that is:

  1. rename workspace directory to a temporary directory name, then
  2. start a background task for deleting that temporary directory.

(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.

like image 96
Alex O Avatar answered Oct 23 '22 08:10

Alex O