Known Issues | Support | Task Parameters | Task Behavior | TFS 2015 Support | FAQ
Post Build Cleanup
Did you ever run out of disk space on your build machine, because there were so many sources and binaries from previous build runs? Then this extension is for you!
By default, the clean option of a build definition deletes files before the build starts. Thus, every build leaves behind sources and binaries on your build machine, and those files accumulate and eat up your disk space. If you're not running incremental builds, those files are not needed after the build has finished.
The Post Build Cleanup task deletes unwanted files from your build agent, after your build has run, thus, saving precious disk space.
You can find the changes notes for this task here.
- We are phasing out Team Foundation Server 2015. If you're still using Team Foundation Server 2015, please stay on version 2.x of the extension which can be downloaded here. For newer versions of Team Foundation Server or Azure DevOps Services please use version 3.x and higher.
If you need help with the extension or run into issues, please contact us at firstname.lastname@example.org.
Adding the Task to a Build Definition
The Post Build Cleanup task (in task category Utility) must always be the last (enabled) task in your build definition!
Disable NodeJS certificate check: Check this option if your Team Foundation Server is using a self-signed or corporate SSL certificate and your build agent version is lower than 2.117.0. The option disables the certificate chain validation of NodeJS. Please read here for details.
YAML: disableCertCheck - Default is false. Set to true to activate the option.
Behavior of the Task
The task behavior is directly linked to the clean options you select in your build definition's Repository settings. In the new build UI the clean option has been moved to the Get sources task in the Tasks list.
If the Clean option is unchecked, the task does nothing. Otherwise, the task behavior depends on the selected value for Clean options and mimics the pre-build cleanup behavior:
Sources: If this option is selected, the task tries to clean the sources as described here, which supports incremental gets of source files.
Note: The task cannot scorch TFVC workspaces due to an authentication limitation. If you use TFVC, the task will always delete all contents of the $(Build.SourcesDirectory), thus, preventing incremental source gets!
Sources and output directory: If this option is selected, the task deletes all contents of the $(Build.BinariesDirectory) in addition to the cleanup described under Sources.
Sources directory: If this option is selected, the task deletes all contents of the $(Build.SourcesDirectory).
Note: If your build uses a Git repository, a minimal portion of the .git folder will remain on disk. Those remaining files are needed by the build agent's built-in Post Job Cleanup.
All build directories: If this option is selected, the task deletes all contents within the $(Agent.BuildDirectory) and recreates the internal folder structure (i.e., the subfolders a, s, and b).
Support for Team Foundation Server 2015
Team Foundation Server 2015 does not support the Clean options parameter. To configure the cleanup behavior, set the build variable Build.Clean as described here. The values of Build.Clean are matched to the Clean options parameter as follows:
- Not set = Sources
- binary = Sources and output directory
- source = Sources directory
- all = All build directories
Because the build agent that comes with Team Foundation Server 2015 does contain a Git command line client, you must install Git on the build machine, in order to support source cleanup. If Git is not installed, the task will fall back to delete all contents of the $(Build.SourcesDirectory).
We have put together a list of frequently asked questions and answers in our FAQ document. If you feel we need to add a specific question to the list, feel free to send it to our support address.
Icon made by Freepik from www.flaticon.com is licensed by CC 3.0 BY