我们已经设置了一个Amazon代理,它在启动时运行一个基于EC2的映像(标记为2020.2.1)。代理由TeamCity云配置文件激活和停用。
除了:每次启动代理时,TeamCity服务器都将其注册为“新”代理(属于同一云映像)。很快,我们就有了几十个不同的、“不同的”代理,它们都在同一个云配置文件中。
这是我们的云配置文件列表,到处都是代理:

这是一些特工的名单--相同的名字,加上一个递增计数器:

,这是我们在机器启动时运行的docker命令:
docker run -d -it -e SERVER_URL=$OUR_URL -e AGENT_NAME="Software-Linux-dockerAgent-01" \
-v /home/ubuntu/ci_agent/agent_config:/data/teamcity_agent/conf \
-v /home/ubuntu/ci_agent/work:/opt/buildagent/work \
-v /home/ubuntu/ci_agent/system:/opt/buildagent/system \
my_linux_ci_agent:1.4服务器日志显示,每次代理连接时,它都“没有定义名称”,因此将为其生成一个新名称。
[2021-01-17 15:13:44,401] INFO - jetbrains.buildServer.AGENT - Set generated name "Software-Linux-EC2-Agent-01-i-09307d6796743bda4-2" to agent "" {id=66} as it had no name defined.
[2021-01-17 16:29:54,529] INFO - jetbrains.buildServer.AGENT - Set generated name "Software-Linux-EC2-Agent-01-i-09307d6796743bda4-3" to agent "" {id=67} as it had no name defined.
[2021-01-17 23:21:29,798] INFO - jetbrains.buildServer.AGENT - Set generated name "Software-Linux-EC2-Agent-01-i-09307d6796743bda4-4" to agent "" {id=68} as it had no name defined.
[2021-01-18 09:27:10,853] INFO - jetbrains.buildServer.AGENT - Set generated name "Software-Linux-EC2-Agent-01-i-09307d6796743bda4-5" to agent "" {id=69} as it had no name defined.是什么导致了这个问题,我该如何解决呢?
只是更多的信息,我检查和尝试到目前为止。
我希望通过保存在/data/teamcity_agent/conf卷中的代理配置数据,这应该足够在下一次运行时,代理被“识别”。我可以看到,agent_config/buildAgent.properties确实记录了服务器分配的名称和授权令牌:
## The unique name of the agent used to identify this agent on the TeamCity server
## Use blank name to let server generate it.
## By default, this name would be created from the build agent's host name
name=Software-Linux-EC2-Agent-01-i-09307d6796743bda4-9
(...)
## A token which is used to identify this agent on the TeamCity server for agent authorization purposes.
## It is automatically generated and saved back on the first agent connection to the server.
authorizationToken=eb0b786556d8f12c1c8917cb10dfdd14但是,下次启动码头映像时,它将被新值覆盖:
## The unique name of the agent used to identify this agent on the TeamCity server
## Use blank name to let server generate it.
## By default, this name would be created from the build agent's host name
name=Software-Linux-EC2-Agent-01-i-09307d6796743bda4-10
(...)
## A token which is used to identify this agent on the TeamCity server for agent authorization purposes.
## It is automatically generated and saved back on the first agent connection to the server.
authorizationToken=f966d0c9f6e44fe284243edd19cfba69我在TeamCity社区论坛上发现了一篇类似的文章,其中与代理云插件连接的单个AWS EC2实例上的多个TC构建代理为每次运行生成新的代理名称和症状听起来非常相似。但是在我的例子中,我只有一个构建代理在实例上运行。
发布于 2021-07-01 09:23:03
问题似乎是在配置初始化过程中,在path /opt/buildagent/conf/上创建了一个amazon-i-$ID标记文件,其名称为amazon-i-$ID格式。
标准说明不包括将/opt/buildagent/conf/持久化为卷,但这将解决问题。
https://stackoverflow.com/questions/65993123
复制相似问题