How do you match the build agent version/plugins to the server's

Answered

When our build agents come up for the first time they check in with the server and realize that there are new build agent plugins to download. This effects are agent start times. How do I ensure that the server's agent software matches the build agent calling in. Thanks. 

 

[2019-04-30 17:25:31,664]   INFO - buildServer.AGENT.registration - Registering on server via URL "https://server.address": AgentDetails{Name='build-chef-agent-ea13b28d', AgentId=null, BuildId=null, AgentOwnAddress='null', AlternativeAddresses=[172.17.0.4], Port=9090, Version='58658', PluginsVersion='NA', AvailableRunners=[], AvailableVcs=[], AuthorizationToken='', PingCode='***'}
[2019-04-30 17:25:32,134] INFO - buildServer.AGENT.registration - Server supports the following communication protocols: [polling]
[2019-04-30 17:25:32,134] INFO - buildServer.AGENT.registration - Trying to register on server using 'polling' protocol.
[2019-04-30 17:25:32,159] INFO - r.artifacts.impl.HttpDiskCache - Cleaning up items with life time in cache greater than 172800 seconds
[2019-04-30 17:25:32,160] INFO - r.artifacts.impl.HttpDiskCache - Finished cleaning up expired items, 0 items removed
[2019-04-30 17:25:32,161] INFO - dDirectoryBasedCleanupRegistry - Removing files from /buildAgent/temp/.old
[2019-04-30 17:25:32,161] INFO - dDirectoryBasedCleanupRegistry - Removing files from /buildAgent/work/.old
[2019-04-30 17:25:32,197] INFO - l.directories.DirectoryMapImpl - Cleaning up old checkout directories. Default lifetime = 192 hour(s)
[2019-04-30 17:25:32,260] INFO - ldServer.AGENT.PollingProtocol - Start polling server for commands
[2019-04-30 17:25:32,262] INFO - buildServer.AGENT.registration - Registered on server with id 819 and authorization token '***'
[2019-04-30 17:25:32,262] INFO - buildServer.AGENT.registration - If this is the first time this agent registered on the server make sure it is authorized by administrator in the server web UI.
[2019-04-30 17:25:32,338] INFO - ldServer.AGENT.PollingProtocol - New command is received from server "testLocal" {id = 1}
[2019-04-30 17:25:32,991] INFO - ldServer.AGENT.PollingProtocol - New command is received from server "upgrade" {id = 2}
[2019-04-30 17:25:32,993] INFO - jetbrains.buildServer.AGENT - Upgrade call received from the build server
[2019-04-30 17:25:32,993] INFO - jetbrains.buildServer.AGENT - Will upgrade when become idle
[2019-04-30 17:25:32,994] INFO - jetbrains.buildServer.AGENT - Wait for build agent registration to finish
[2019-04-30 17:25:32,994] INFO - jetbrains.buildServer.AGENT - Registration of build agent is finished.
[2019-04-30 17:25:32,994] INFO - jetbrains.buildServer.AGENT - Stop command was not performed. No build to stop with reason: BuildInterruptReason.AGENT_SHUTDOWN
[2019-04-30 17:25:32,994] INFO - jetbrains.buildServer.AGENT - Starting agent shutdown sequence, reason: Restart agent, failed to download upgrade from server
[2019-04-30 17:25:32,996] INFO - jetbrains.buildServer.AGENT - Url for downloading updates: https://server.address
[2019-04-30 17:25:32,997] INFO - jetbrains.buildServer.AGENT - Downloading https://server.address/update/teamcity-agent.xml ==> /buildAgent/temp/8PnNCWHoHppIF725ZcAOJckFy2EEpPOl
[2019-04-30 17:25:33,000] INFO - agent.impl.AgentPortFileWriter - Delete agent runtime file from /buildAgent/logs/buildAgent.xmlRpcPort
[2019-04-30 17:25:33,000] INFO - jetbrains.buildServer.AGENT - Unregistering from the server. Agent id: 819
[2019-04-30 17:25:33,314] INFO - jetbrains.buildServer.AGENT - Downloading https://server.address/update/plugins/agentSystemInfo.zip ==> /buildAgent/update/plugins/agentSystemInfo.zip
[2019-04-30 17:25:33,387] INFO - jetbrains.buildServer.AGENT - Shutdown agent WebServer start
[2019-04-30 17:25:33,388] INFO - jetbrains.buildServer.AGENT - Shutdown agent WebServer finish
0
1 comment

Hi,

 

upon startup of an agent, as well as regularly while it's running, the agent will automatically connect to the server, request version information for both the agent itself and the plugins, and stop to upgrade whenever it finds a mismatch. In your case, there is a number of empty set of fields during registration, which very likely means that either the agent is not able to save the data (incorrect permissions not allowing to save that information in the build agent folder), or that the agent is spawned anew every time (cloud agents,  containers, etc). The first case should be easily solved, simply ensure that the agent process can write in its own folder. This can lead to agents entering in a loop of attempting to start and download everything until the conditions are properly met for an upgrade.

 

The second case can be slightly more complex. If you are using your own VMs or own images, we can recommend starting up the vm/image, then waiting for the agent to connect and download everything. At that point, take that new state as a new image and use it as the new base to work with.

0

Please sign in to leave a comment.