Distributed Workspace Clean1.0.7Minimum Jenkins requirement: 2.60.3ID: hudson-wsclean-plugin

Installs: 3065
Last released:
Thomas Spengler
Alan Harder
Arnaud Héritier
Peter Darton

This plugin allows you to cleanup workspaces on slaves "this" build has previously used.

Distributed Workspace Clean plugin

Intention of this plugin

This plugin is made to cleanup the build's workspace in all slave nodes except the one(s) currently running.

If you have many jobs and many slaves that can build them, you will eventually end up with every slave having built every build at least once, meaning that every slave has a copy of the build workspace for every build, and this combination results in a lot of disk space being used.  The "Workspace" link for a job only ever points to the most recently used slave node, so that means that all slave nodes except one could safely delete their unused workspaces ... but Jenkins does not do that by default.

For this reason this plugin provides the possibility to delete the workspaces after a build (or before the build if preferred).

How to use it

This functionality can be enabled by ticking the box in the "Build Environment" section of a job's configuration, and optionally expanding the "Advanced" box and ticking the "clean before" checkbox if you'd prefer the clean to happen at the start of the build instead of at the end (the default).

How to avoid it

If you have slave nodes that should never have their workspaces cleaned (by this plugin) then you can add a Node Property specifying (in the node's configuration page) that this plugin should always skip them:

For example, slave nodes that are dynamically created (and deleted) by a cloud plugin are unlikely to require cleaning (as they'll be destroyed before they have a chance to build up much mess), so it's useful to add this Node Property to the template(s) from which such slave nodes are created.

Note: If you can't add a node property due to limitations on the type of slave node (e.g. not all cloud plugins support node properties), you can achieve the same effect using the "Nodes to ignore" field in the global configuration.

How to control it

Further options to control which slave nodes are selected for cleanup can be found in the global configuration page (Manage Jenkins → Configure System):

The default setting is to "clean nodes that could be used" (for the build), which preserves the behavior of plugin version 1.0.5 and earlier (where the plugin looks at what other slave nodes could have been used to run the build, and cleans the workspace that would've been used on each of those).  As of version 1.0.6 onwards, you can choose to clean only where previous completed builds had run, or both.

For further details, see the help text associated with each configuration option.

Change Log

Version 1.0.7 (Sept 24, 2019)
  • Functionality unchanged from 1.0.6.
  • Meta-data for plugin now lists license and developers (past and present).
Version 1.0.6 (Aug 28, 2019)
  • (error) Don't clean concurrently-running builds (JENKINS-43269)
  • (info) Implement timeouts so dud slave nodes don't block all builds
  • (info) Implement "parallel cleanup" to improve performance
  • (info) Implement "skip node" node property and skip-by-name functionality
  • (info) Make "Skip roaming" configurable
Version 1.0.5 (Aug 6, 2015)
  • (error) Fix Compatibility with Folder plugin (JENKINS-29682)
  • (error) Fix deletion on master
  • (error) Don't wait for slave to become online/don't try to reconnect slave, if slave is offline
  • (info) Various cleanup/refactoring
  • (info) First release from GitHub
Version 1.0.4 (Jan 7, 2010)
  • Fix NPE while running PrePostClean on a project that can roam
  • Update code for more recent Hudson
Version 1.0.3 (Oct 12, 2009)
  • Fix broken classinformation due to change of from interface to abstract class
  • Fix JENKINS-4630, NPE while running PrePostClean without any slaves
Version 1.0.2
  • Fix for release
Version 1.0.1
  • Initial checkin
ArchivesGet past versions