Child pages
  • Swabra

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


The plugin remembers the state of the file tree after the sources checkout and then on next build start deletes all the newly added files on the build finish or on next build start (depending on the options).

The plugin also gives the ability to dump processes which lock the checkout directory before build finish (requires handle.exe)


The current plugin version is designed to work with TeamCity 5.1.x, TeamCity 5.0.x and TeamCity 4.5.x (there are three plugin configurations).


Directly from public TeamCity server:
5.1.x last nightly build
5.0.x last nightly build
4.5.x last nightly build


The plugin can be used with any runner. Swabra tab provides UI options to enable scanning checkout directory for newly created, modified and deleted files and for enabling file locking processes detection.

Cleaning can be performed before or after the build.

Checkout directory state is saved into a file in the caches directory named <checkout_directory_name_hash>.snapshot using DiskDir format. Checkout directory to snapshot name map is saved into file. The snapshot is used later (after the build finish or at the start of the next build) to determine which files and folders are newly created, modified or deleted. It is done by actual files' presence, last modification data and size comparison with corresponding records in the snapshot.

In any mode Swabra performs newly created files deletion.


Сonfiguring plugin via UI options

The plugin adds its configuration settings panel to the runner settings page.

Check Perform build files cleanup option to enable build files cleanup.
Use Ensure clean checkout directory to ensure that the checkout directory corresponds to the sources in the repository at the build start. If detecting any modified or deleted files in the checkout directory before the build start Swabra will enforce clean checkout. Without Strict mode The build will also fail if some newly created during previous build files can't be deleted.

Without Perform build files cleanup you will only get warnings about modified and deleted files.

With Kill locking processes option checked when Swabra comes across a newly created file which is locked it tries to kill the locking process and finally perform the deletion.

Сonfiguring plugin via UI options

The plugin adds its configuration settings panel to the runner settings page: choose Swabra mode as before or after build.

If you choose After build mode build files cleanup will be performed after the build. Between builds there will be clean copy in the checkout directory which gives possibility to free more disk space.
If you choose Before next build mode previous build files cleanup will be performed at build start. You only need to use this mode if files are required between builds or for debugging.

Check Strict mode option to enable Swabra "strict" mode. At the build start the checkout directory will correspond to the sources in the repository. Note that in case of detecting modified or deleted files Swabra will initiate clean checkout.

If you check the Kill locking processes option for Windows agents the plugin will attempt to kill locking processes and finally remove files.

Locking processes detection can also be turned on when build files cleanup is disabled. In such case information on locking processes (or their absence) will appear in the build log.

Both killing and detecting locking processes require handle.exeUse Locking processes setting to inspect the checkout directory for processes locking files in this directory.
Choose Report or Kill options to get report about such processes in the build log or kill them.
Note that for locking processes detection handle.exe is required on agents. Click the Download handle.exe link for downloading.

Check Verbose output option to enable detailed logging to build log (only for before build mode).

Downloading Handle

Specify URL for downloading, press Download button and TeamCity will automatically download Handle, extract and send to Windows agents.
handle.exe will be present on agents only after the upgrade process.
Note that you need to have enough permissions to start the download.