TeamCity 8.0 Help

Free disk space

The Free disk space Adding Build Features allows ensuring the build gets enough disk free space.

Analyzing and Freeing disk space

Before the build and before each build preparation stage, the agent will check the currently available free disk space. If the amount is less than specified, it will try to clean data of other builds before proceeding.

The data cleaned includes:

  • the checkout directories that were marked for Build Checkout Directory;

  • the cache of previously downloaded artifacts (that were downloaded to the agent via TeamCity artifact dependencies)

  • contents of other build's checkout directories in the reversed most recently used order.

The disk space check is performed for two locations: the agent's temp directory and the build checkout directory.

By default, each build has the required free space set to 3Gb. You can specify a custom free disk space value.

If you need to make sure a checkout directory is never deleted while freeing disk space, set the system.teamcity.build.checkoutDir.expireHours property to "never" value. See more at Build Checkout Directory.

Other ways to set the free disk space value

Besides, for compatibility reasons the free disk space value can be specified via properties. However, it is advised to use the Adding Build Features as the properties can be removed in the future TeamCity versions. The properties can be defined:

  • globally for a build agent (in agent's buildAgent.properties file)

  • for a particular build configuration by specifying its system properties.

The required free space value is defined with the following properties: system.teamcity.agent.ensure.free.space for the build checkout directory. system.teamcity.agent.ensure.free.temp.space for the agent's 'temp' directory. If teamcity.agent.ensure.free.temp.space is not defined, the value of the teamcity.agent.ensure.free.space property is used.

The values of these properties specify the amount of the available free disk space to be ensured before the build starts. The value should be a number followed by kb, mb, gb, kib, mib, or gib suffix. Use no suffix for bytes. e.g. system.teamcity.agent.ensure.free.space = 5Gb

Configuring artifacts cache

Since TeamCity 8.1, each build stores all artifacts in <Build Agent home> \system\.artifacts_cache, which can be undesirable if the artifacts are large and not used within TeamCity. It can also affect a build's behavior if the artifacts cache directory is not on the same disk as the build checkout directory, or if the builds do not define the Free disk space build feature and the default 3Gb is not sufficient for a build.

Caching artifacts on the agent can be turned off by adding the teamcity.agent.filecache.publishing.disabled=true configuration parameter to a project or one of the build configurations of a project. However, the agent will still cache artifacts downloaded as artifact dependencies.

You can limit the size of artifacts cache using the teamcity.agent.filecache.size.limit.bytes = <size limit in bytes> configuration parameter in the Build Agent Configuration file.

Last modified: 20 April 2023