Team Build - 无法访问后自动重新启用代理
我们有一个中央 Team Foundation Server (2008) 部署,所有项目都存储在其中。 每个项目都会设置自己的构建服务器,运行 Team Build 来执行自己的自动化构建。
问题就在这里。 当在 TFS 和 Team Build 服务器之间检测到连接错误时,它会将构建代理的状态移至“无法访问”,这意味着它不可用于任何后续构建。 我们的服务器已安排重新启动窗口,当 TFS 在该窗口期间无法与这些代理通信(反之亦然)时,会将代理移至“无法访问”。 每天早上我们进来都会发现我们必须手动进去并重新启用代理。
是否有可能让团队建设代理在再次可用时立即恢复在线? 或者编写一个脚本让它们自动重新上线?
We have a central Team Foundation Server (2008) deployment where all projects get stored. Each project sets up their own build server running Team Build to do their own automated builds.
Here's the problem. When a connection error is detected between TFS and the Team Build server, it moves the build agent's status to 'unreachable' which means it's not available for any subsequent builds. Our servers have scheduled reboot windows and when TFS can't communicate with those agents (or vice-versa) during that window, it moves the agent to 'unreachable'. Every morning we come in and find that we have to manually go in and reenable the agent.
Is it possible to have the team build agents come back online as soon they're available again? Or perhaps write a script that brings them back online automatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在TFS2008中,AT应该定期(15-30分钟,暂时不记得间隔)对无法访问的构建代理执行ping操作,以查看其是否已备份。 您没有看到这种行为吗?您的行为是否仍然无法访问?
也就是说,可以编写一些可以定期运行的 .NET 代码来设置构建代理的状态。 或者,您可以在作为构建代理运行的 Windows 计算机上启动后将其作为计划任务运行,以与 TFS 对话并将其状态设置回良好状态。
要编写代码,您需要使用 TFS 构建 API (Microsoft.TeamFoundation.Build.Client)。 特别是您想查看 IBuildAgent< /a>. 从 IBuildServer,更改状态,然后调用buildAgent.Save()。
In TFS2008, the AT should ping the unreachable build agent on a regular period (15-30 minutes, can't remember the interval at the moment) to see if it is back up. Are you not seeing this behaviour - do yours stay unreachable?
That said, it is possible to write a bit of .NET code that you could run periodically to set the status of the build agent. Alternatively you could run it as a scheduled task after start-up on the windows machine that is running as your build agent to go talk to TFS and set it's status back to good.
To write the code, you want to use the TFS Build API (Microsoft.TeamFoundation.Build.Client). In particular you want to look at the IBuildAgent. Get the appropriate one from the IBuildServer, change the status and then call buildAgent.Save().
我自己也看到过这个问题 - 这是一个 Powershell 脚本,它将迭代所有团队项目上的所有构建代理并启用它们。 请注意,代理将更新为立即启用,无论它们是否有效(因此,如果脚本运行时构建服务器仍然关闭 - 一旦构建触发 - 它将恢复为“无法访问”)
I've also seen that problem myself - Here's a Powershell script that will iterate all build agents on all Team Projects and enabled them. Note that the agents will be updated to enable immediately regardless of whether they are valid (so if the build server is still down when the script runs - as soon as a build triggers - it will revert to Unreachable)