Build agent is renamed after Teamcity rollback, won't keep proper name
I had to roll back our TeamCity instance Monday night / Tuesday morning after a failed 2018.2 upgrade. It seemed fine, but today I note that the build agent on the TC VM has renamed itself from "Build" to "Build-1".
I edited the buildAgent.properties file, but some process keeps re-editing it to append the "-1" again. We have a number of builds restricted by agent name, so this is quite annoying.
Any suggestions?
Please sign in to leave a comment.
Ah. There is a disconnected agent with the full history, which explains why it wouldn't use that name.
I guess I have to edit the DB and merge these two agents back together?
Hi Chris,
sorry for the delay. Editing the DB is the only available option to merge them, and it should be noted that we would not recommend doing it, especially in a live system. A number of operations are performed on the database related to agent handling which could cause problems if you try to modify the records and anything is not properly converted.
I'm having the same issue. If modifying the database is not recommended, then what is the recommended process for this?
In my case, we bind all of our agents to compatible configurations, but one of our agents has suddenly decided to rename itself, and TeamCity refuses to let it reclaim its original name. We could manually migrate the compatible configurations to the "new" agent name, but that will take quite a long time given the size of our instance.
Is there a way to, for example, recover the authorization token for an agent definition so we can get the agent to properly connect with that name again?
Hi Rob
Is the agent in the 'disconnected' tab? If so, shut down your build agent, go to the "disconnected" tab and remove both the agents (the one with the wrong name and the one with the correct name). Than boot your build agent again, authorize it and voila.
The "AGENTNAME-1" was connected, but "AGENTNAME", which contains all of our bound configurations, was disconnected. Removing the original "AGENTNAME" is not an option as it contains all of our bound configs. We need the agent to be able to reconnect as "AGENTNAME" without removing it.
I eventually recovered the authorization token from the database itself, and was able to reconnect the agent to the correct name that way, but I would like to know if there's an easier way to do that.