Workspace Cleanup Plugin

Skip to end of metadata
Go to start of metadata

Plugin Information

Plugin ID ws-cleanup Changes In Latest Release
Since Latest Release
Latest Release
Latest Release Date
Required Core
0.28 (archives)
Aug 19, 2015
Source Code
Issue Tracking
Pull Requests
Open Issues
Pull Requests
Vojtech Juranek (id: vjuranek)
Oliver Gond��a (id: olivergondza)
Usage Installations 2014-Aug 9931
2014-Sep 10574
2014-Oct 11251
2014-Nov 11495
2014-Dec 11630
2015-Jan 12415
2015-Feb 12976
2015-Mar 13947
2015-Apr 14337
2015-May 14610
2015-Jun 15551
2015-Jul 16127

This plugin deletes the workspace before the build or when a build is finished and artifacts saved.
Option for deleting workspace before build is in Build Environment section:

Option for deleting workspace after is in Post-build Actions section:

You can also specify pattern (using Ant syntax), which files should be deleted:

  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):


matches all .class files/dirs in a directory tree.


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.


matches all files/dirs which start with "XYZ" and where there is a parent directory called test (e.g. "abc/test/def/ghi/XYZ123").


Upcoming changes  
Release 0.27 (2015-08-19)
  • Adjusted console logging
  • Added logging to track down issue #24824
Release 0.26 (2015-05-29)
  • Require minimal width for pattern labels (issue #27103)
  • Do not log exceptions on stderr
Release 0.25 (2015-01-25)
  • Survives workspace rename failure during async delete (issue #26250)
Release 0.24 (2014-09-09)
Release 0.23 (2014-08-26)
Release 0.22 (2014-08-03)
  • Fixed env. var. expansion on nodes
Release 0.21 (2014-06-23)
Release 0.20 (2014-02-01)
  • Fixed build status setting - if the workspace cleanup fails, build status is set to FAILURE (pull #14)
Release 0.19 (2013-10-08)
  • Fixed problem with spaces in external cleanup command (pull #13)
Release 0.18 (2013-09-15)
  • Fixed broken backward compatibility in pre-build cleanup (issue #19574)
Release 0.17 (2013-09-11)
  • Allow to configure external program to do the cleanup (pull #12)
  • Fixed German translation encoding (pull #11)
Release 0.16 (2013-07-02)
  • Added ability to specify if the workspace should be wiped out in pre-build step via a job parameter (pull #10)
Release 0.15 (2013-06-18)
  • Don't wait for previous build step to complete (pull #9)
Release 0.14 (2013-05-14)
Release 0.13 (2013-05-03) 
  • Configure deleting of workspace based on build status (pull #7)
  • German translation (pull #6)
Release 0.12 (2013-02-16) 
  • Retry delete 3 times in prebuild cleanup and add eventually error message into console log (pull #5)
Release 0.11 (2013-01-23) 
  • Added option not to fail the build if some error happens during the clenup (issue #15236)
  • Added option to cleanup matrix parent workspace (issue #14128)
Release 0.10 (2012-07-17) 
  • Fixed skipping the cleanup - skip only when this option is checked (pull #4)
Release 0.9 (2012-07-15) 
  • Added option to skip the cleanup when build fails (pull #3)
Release 0.8 (2012-03-14) 
  • Ensure, that ws cleanup is run after all other plugins (issue #12962)
Release 0.7 (2011-12-07) 
  • Check if workspace exists (issue #11998)
  • Added possibility to delete also directories when delete pattern is spedified (issue #11927)
  • Added possibility to specify also exclude patterns (issue #11928)
  • Added missing Pattern decriptor
Release 0.6 (2011-10-11)
  • Ws clean up should be the first or the last step in case of pre-build or post-build cleanup, respectively (issue #11210)
Release 0.5 (2011-09-27)
  • Added possibility to delete only part of the workspace specified by ant dir scanner pattern.
Release 0.4 (2011-04-07)
  • Bug fix - checkbox for deleting workspace after the build was not showing up on the job config page 
Release 0.3 (2011-03-02)
  • Fix to delete right workspace when "concurrent builds" option is in use
Release 0.2 (2011-02-28)
  • Add an option to delete workspace before build (requires Jenkins 1.399 or higher)
Release 0.1 (2011-02-10)
  • Initial release


plugin-post-build plugin-post-build Delete
plugin-buildwrapper plugin-buildwrapper Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Add Comment