0

I'm in the process of setting up TeamCity on Azure, more specifically I'm setting up some build agents. Certain properties of the build agents are configured via the buildAgent.properties file like name, port etc. I would like to call the agent the name of the computer it is located on but I can't find (and indeed don't know if this is possible) anyway to use environment variables to set the agent name i.e env.COMPUTERNAME?

The only way i seem to be able to do this is by hard coding the name

#Generated properties (see buildAgent.dist.properties for description)
name=tc-agent-001 #is it possible to use environment variable here?
ownPort=9090
serverUrl=http\://mybuildserver.mycompany.com
workDir=C\:\\BuildAgent\\work
tempDir=C\:\\BuildAgent\\temp
#User defined properties
env.TEAMCITY_JRE=C\:\\BuildAgent\\jre

Has anyone figured out a way to do this?

4

1 回答 1

0

我们的代理默认有这种行为。它是出现在 env.COMPUTERNAME 环境变量中的 name 属性,它是每个 VM 的主机名。

如果您的机器主机名与列出的名称不同,只需更改该参数,但由于此文件只是一个已解析的设置列表,因此无法让它以编程方式为您检测主机名。- 除非您编写脚本来检测机器的主机名,然后修改属性文件。

于 2014-06-03T15:06:37.380 回答