Levels and Priority of Build Parameters
Build parameters can be defined at different levels (sorted from higher to lower priority):
Parameters defined in the Run Custom Build dialog.
Parameters defined in Build Configuration Settings.
Parameters defined in Project Settings.
The parameters defined for a project will be inherited by all its subprojects and build configurations. If required, you can redefine them in a single build configuration.Parameters defined in a build configuration template.
Parameters defined in an agent's configuration file.
Environment variables of the build agent process itself.
On the start of a build process, the resultant set of parameters is saved into a file which can be accessed by the build script. To learn more about this file, see the teamcity.build.properties.file
system property or TEAMCITY_BUILD_PROPERTIES_FILE
environment variable descriptions in Predefined Build Parameters.
Project-Level Build Parameters
TeamCity allows you to define build parameters for a project, all its subprojects, and build configurations in one place: Project Settings | Parameters.
If a build parameter with the same name is defined both in a build configuration and on the project level, the following rules apply:
Case 1 | Project A, Build Configuration from project A | Parameters defined in the build configuration have priority over the parameters with the same names defined on the project level. |
Case 2 | Project A, Template T from project A, build configuration from project A inherited from template T | Parameters of the build configuration have priority over the parameters with the same name defined in project A. Project-level parameters have priority over parameters with the same name defined in the template. |
Case 3 | Project A1, Project A2, Template T from project A1, build configuration from project A2 inherited from template T | Parameters of project A2 (the one build configuration belongs to) have priority over the parameters with the same names defined in the template. |
Expected Parameter Format
When defining system properties or environment variables in the teamcity.default.properties
file, use the following format: system.<property_name>=<property_value>
or env.<property_name>=<property_value>
. For example, env.CATALINA_HOME=C:\tomcat_6.0.13
.
The names of parameters must contain only the [a-zA-Z0-9._-*]
characters and start with an ASCII letter.
Set Parameters for Build Configurations Using Same VCS Root
You can also define parameters for only those build configurations of the project that use the same VCS root. To do that, create a text file named teamcity.default.properties
and check it in to the VCS root. Ensure that the file appears directly in the Build Working Directory by specifying the appropriate checkout rules. The name and path to the file can be customized via the teamcity.default.properties
parameter of a build configuration.
The parameters defined this way are not visible in the TeamCity UI, but are passed directly to the build process.
Agent-Level Build Parameters
To define parameters specific to a certain build agent, you need to edit this agent's <Agent Home>/conf/buildAgent.properties
configuration file. Refer to this section for more information on available predefined parameters for agents.
The expected format is the same as at the project level: [system|env].<property_name>=<property_value>
.