{jenkins-plugin-info:ws-cleanup}

Plugin to delete the build workspace.

Pre-pipeline

The plugin declared build wrapper (Delete workspace before build starts) and post build step (Delete workspace when build is done). They both permit configuring what and in what circumstances will be deleted. The post build step can also take into account the build status.


Files to be deleted are specified by pattern using Ant syntax. Pattern is typed into field (1). In select box (2) you can choose if the pattern is include pattern (if the file matches this pattern, file will be removed) or exclude pattern (if file matches this pattern, file won't be removed). If there is only exclude pattern, as include pattern will be used "*/", i.e. delete everything, which means that everything will be deleted except files matching exclude pattern. Patterns are applied only on files. If you want to apply them also on directories, check checkbox (3). Please note, that directory is deleted with all content, so if the directory matches include pattern, everything in this dir will be deleted no matter if some files in this dir matches exclude pattern.

Example of the patterns (taken from DirectoryScanner javadoc, for detail see javadoc):

**/*.class		// matches all .class files/dirs in a directory tree.
test/a??.java	// matches all files/dirs which start with an 'a', then two more characters and then ".java", in a directory called test.
**				// matches everything in a directory tree.
**/test/**/XYZ* // matches all files/dirs which start with "XYZ" and where there is a parent directory called test (e.g. "abc/test/def/ghi/XYZ123").


When whole workspace is supposed to be deleted (no patterns, external commands, etc.), the plugin delegate to the Resource Disposer Plugin to speed things up.

Disable deferred wipeout method

In particular deployment (e.g. cloud) it might be useful to be sure deferred wipeout is never selected as a cleanup method. Therefore there is a new feature introduced to do this, implemented via regular NodeProperty which you can attach to any node via UI or via script like:

Node.getNodeProperties().add(new DisableDeferredWipeoutNodeProperty());

When deferred wipeout is disabled the old implementation of filesystem content deletion is used. If you want the same behavior as with deferred wipeout, you have to set plugin attribute deleteDirs to true as well. In pipeline job's script, you can do that like:

cleanWs disableDeferredWipeout: true, deleteDirs: true


Changelog

Release 0.37 (2018-12-17)
Release 0.35 (2018-10-11)
Release 0.34 (2017-07-17)
Release 0.33 (2017-04-24)
Release 0.32 (2016-11-01)
Release 0.30 (2016-06-24)
Release 0.27 (2015-08-19)
Release 0.26 (2015-05-29)
Release 0.25 (2015-01-25)
Release 0.24 (2014-09-09)
Release 0.23 (2014-08-26)
Release 0.22 (2014-08-03)
Release 0.21 (2014-06-23)
Release 0.20 (2014-02-01)
Release 0.19 (2013-10-08)
Release 0.18 (2013-09-15)
Release 0.17 (2013-09-11)
Release 0.16 (2013-07-02)
Release 0.15 (2013-06-18)
Release 0.14 (2013-05-14)
Release 0.13 (2013-05-03) 
Release 0.12 (2013-02-16) 
Release 0.11 (2013-01-23) 
Release 0.10 (2012-07-17) 
Release 0.9 (2012-07-15) 
Release 0.8 (2012-03-14) 
Release 0.7 (2011-12-07) 
Release 0.6 (2011-10-11)
Release 0.5 (2011-09-27)
Release 0.4 (2011-04-07)
Release 0.3 (2011-03-02)
Release 0.2 (2011-02-28)
Release 0.1 (2011-02-10)