Monday, April 10, 2017

Reconnecting TeamCity build agent

We use TeamCity to build our projects when deploying to staging and production servers. Sometimes the Build Agent will get disconnected if the server gets restarted, and for some reason it won't reconnect.



If you are googling this issue frantically (like I have), you'll find a lot of people suggesting to open up Services in Windows and restarting the TeamCity Build Agent service. While this is needed, I found that doing so didn't reconnect the agent.

I finally started looking through the build agent configuration files, and found that the port change I had just done wasn't reflected in the build agent files. The file I was looking at was <TeamCity installation directory>\buildAgent\conf\buildAgent.properties and buildAgent.dist.properties. I had changed the port number for the web login, and while I saw in the buildAgent.dist.properties that it had the new port in the serverUrl config, the buildAgent.properties file still had the old port in the generated serverUrl.

I'm still not sure why the TC generation wasn't working, but I manually changed the port in the buildAgent.properties file. After restarting the TeamCity Build Agent service once more for good measure, I was able to see that the build agent was reconnected in the web interface.

No comments:

Post a Comment