Build Checkout Directory
The build checkout directory is the directory where all of the project's sources reside. If the VCS checkout mode
property of the build configuration is set to Automatically on server or Automatically on agent, TeamCity places the sources into the checkout directory according to the mapping defined in the VCS Checkout Rules.
If not specified, automatically created directory is used with a generated name: < >/<VCS settings hash code>
. The VCS settings hash code is calculated based on VCS roots and VCS settings used by the build configuration. Effectively, this means that the directory is shared between all the build configurations with the same VCS settings.
If you need to know the directory used by a build configuration, you can refer to < >/directory.map
generated file which lists build configurations with the directory used by them.
If for some reason default directory does not match your requirements (for example, the process of creating builds depends on some particular directory), you may want to 2.Version Control Settings.
As a kind of failover measure TeamCity automatically performs Clean Checkout, if it finds files of another build configuration in the current checkout directory or the directory is empty.
In your Build Script Interaction with TeamCity you may refer to the effective value of build checkout directory via the teamcity.build.checkoutDir
Properties of a Build Configuration provided by TeamCity.
Automatic Checkout Directory Cleaning
Checkout directories are automatically deleted from disk if not used (no builds use it as checkout directory) for a specified period of time (8 days by default). This behavior only applies to default checkout directories (explicitly specified checkout directories are not cleaned).
The time frame can be changed by specifying new value (in hours) by either of the following ways:
'teamcity.agent.build.checkoutDir.expireHours'
Defining Properties in thebuildAgent.properties
file;'teamcity.build.checkoutDir.expireHours'
Properties of a Build Configuration
Setting the property to "0" will cause deleting the checkout directories right after the build finish.
Cleaning Directory in Background
When a build's sources are checked out to a build checkout directory on a build agent and before the build is started to run, TeamCity checks the available free space. By default, the required free space is 3Gb. You can specify the free space value for a build agent in its buildagent.properties
file or change the default value for a particular build configuration by specifying its system properties.
Required free space value is defined by the following properties:
Set
teamcity.agent.ensure.free.space
with bytes to ensure space under build configuration folder.Set
teamcity.agent.ensure.free.temp.space
with bytes to ensure space under 'temp
' folder. Ifteamcity.agent.ensure.free.temp.space
is not defined, the value ofteamcity.agent.ensure.free.space
property will be used.
TeamCity checks the values in the following order:
build configuration system property
buildAgent.properties
file propertyif no specified property values found, then TeamCity uses the default value — 3Gb.
Generally, the teamcity.agent.ensure.free.space
property value is set in bytes. Also, you can specify the value in kb
, mb
, gb
, kib
, mib
, or gib
.
If build agent does not have required free space under temp
or build checkout folders, .old
directories cleanup is started.