Agent Requirements
Agent requirements are used in TeamCity to specify whether a build configuration can run on a particular build agent besides agent pools and specified build configuration restrictions.
When a build agent registers on the TeamCity server, it provides information about its configuration, including its environment variables, system properties, and additional settings specified in the buildAgent.properties
file.
The administrator can specify required environment variables and system properties for a build configuration on the Build Configuration Settings | Agent Requirements page. For instance, if a particular build configuration must run on a build agent running Windows, the administrator specifies this by adding a requirement that the teamcity.agent.jvm.os.name
system property on the build agent must contain the Windows
string.
If the properties and environment variables on the build agent do not fulfill the requirements specified by the build configuration, then the build agent is incompatible with this build configuration. The Agent Requirements page lists both compatible and incompatible agents. Multiple agent requirements for a single parameter can be added. The conditions are treated as 'and' to determine compatible agents.
It is possible to disable a configured requirement using the corresponding option in the requirements list.
Sometimes the build configuration may become incompatible with a build agent if the build runner for this configuration cannot be initialized on the build agent. For instance, .NET build runners do not initialize on UNIX systems.
Implicit Requirements
Any reference (a name enclosed in %
characters) to an unknown parameter is considered an implicit requirement, which means that the build will only run if:
an agent provides this parameter,
or the parameter is defined on the build configuration (or project) level. The priority of the build configuration's value is higher than of the value defined on an agent.
For instance, if you define a build runner parameter as a reference to another property: %env.JDK_16%/lib/*.jar
, this will implicitly add an agent requirement for the referenced property: that is, env.JDK_16
must be defined. To define such properties on the agent, you can:
Specify them in the
buildAgent.properties
file.Set the environment variable
JDK_16
on the build agent.Specify the value on the Parameters page of a build configuration (or in the Project Settings ). The same value of the property will be used for all build agents.