Child pages
  • Swabra

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Described new plugin features


The plugin remembers the state of the file tree after the sources checkout and then 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)

Plugin Development Status


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


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


Cleaning can be performed before or after the build.

First the plugin is turned on, it initiates clean checkout, after which in the checkout directory there are only essential files and no "garbage". At this moment the state of the checkout directory 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 int into file. This 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 modifieddeleted. 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.

Use Strict mode 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 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


Check Strict mode option to enable Swabra "strict" mode. The build will fail if at the start there are any files which were created during previous build.When performing files deletion on Windows agents Swabra may come across files and folders which are locked by some outside processesAt 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 Determine file Kill locking processes on option for Windows agents option the plugin will attempt to kill these locking processes and finally remove files (in Strict mode) or just report (in normal mode) these processes.

If this option is unchecked list of newly created during the build files, which Swabra failed to delete will appear in the build log.

Locking processes detection can also be turned on when build files cleanup is disabled. In such case useful information about on locking processes (or their absence) will appear in the build log.To enable locking processes detection you also have to download Handle.

Both killing and detecting locking processes require handle.exe. 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.
The executable will be stored under <agent>\plugins\ handle-provider\bin.
Note that Handle .exe will be present on agents only after the upgrade process.
Note that you need to have enough permissions to start the download.

You may also download Handle, extract it on agent and set up the handle.exe.path system property manually.