Configure Agent Installation
A build agent can be configured by adjusting in the <TeamCity Agent Home>/conf/buildAgent.properties
file.
General Agent Configuration
This Java properties configuration file can store properties that will be published on the server as agent properties and can participate in the Agent Requirements expressions. All system and environment properties defined in the file will be passed to every build run on the agent.
Syntax reference:
Use
property_name=value<newline>
syntax.Use
#
in the first position of the line for a comment.Use
/
instead of\
as the path separator. If you need to include\
, escape it with another\
.Whitespaces are processed as any other symbol.
Example agent configuration file:
Make sure the file is writable for the build agent process itself. For example, that the file is updated to store its authorization token generated on the server-side.
If the name
property is not specified, the server will generate a build agent name automatically. By default, this name will be created from the build agent's host name.
The file can be edited while the agent is running: the agent detects the change and (upon finishing a running build, if any) restarts automatically loading the new settings.
Optional Properties
Build Agent Port
The port where the TeamCity build agent starts and where it listens for the incoming data from the server is determined via the ownPort
property (9090 by default). If the firewall is configured, make sure that the incoming connections for this port are allowed on the agent machine.
If more than one build agent is hosted on the same machine, different ports must be assigned to them via the ownPort
property in the buildAgent.properties
file of every agent.
Build Agent IP Address
When an agent connects to the TeamCity server for the first time, the agent automatically determines its IP address to use for connection, unless the ownAddress
property is defined. If the agent machine has several network interfaces, automatic detection may fail. In this case, it is recommended to specify the ownAddress
property:
Alternative Fetch URL
If you have a self-updating Git repository proxy that is significantly closer than the original Git repository for certain agents, you can allow these agents to download sources from this mirror. To do so, add the teamcity.git.fetchUrlMapping.<name>=<original URL> => <proxy URL>
setting to the agent configuration file. See this section for more information: Git VCS Root | General Settings.
The Configure Command
To set up the buildAgent.properties file, you can run the <Agent_folder>/bin/agent.bat
or <Agent_folder>/bin/agent.sh
script with the configure
command. This command allows you to set up core agent properties and save them to the target configuration file. If no configuration file path is specified, the changes will be saved to the default <Agent_folder>/conf/buildAgent.properties
properties.
To view the list of available parameters, run this command with the --help
flag.
Sample command that writes the server URL and sets up the custom agent name:
Set up Agent Behind Proxy
It is possible to configure a forward proxy server for agent-to-server connections.
On the TeamCity agent side, specify the proxy to connect to the TeamCity server using the following properties in the buildAgent.properties
file:
If the proxy has a HTTPS endpoint, you can also configure the teamcity.https.*
properties.