Can I tell an agent not to upgrade?

tldr Short question - our agent keeps failing on upgrade.  Is there a way I can tell it to not upgrade?

Long question -

We have a build agent that recently did the following:

It exits/stops the service so that it can upgrade.
As part of the many many file operations, it deletes TeamCityAgentService-windows-x86-32.exe (the service)
It then tries to copy a new TeamCityAgentService-windows-x86-32.exe from the update folder to the current folder.  At this point, it gets an access denied error:

WARN - buildServer.agent.LauncherUtil - Failed to copy C:\TeamCity\buildAgent\update\launcher\bin\TeamCityAgentService-windows-x86-32.exe to C:\TeamCity\buildAgent\launcher\bin\TeamCityAgentService-windows-x86-32.exe. Access is denied

This is mere moments (70 milliseconds) after the delete operation.

It realizes there's a problem and tries to restore from the backup folder.  Same problem though - access denied to the non-existent exe.

What could be the areas to investigate here, why is it unable to write the new exe even though (I checked) it deleted successfully?

Just to clarify - I've tried reinstalling the agent several times, and having it run as system account or an account with admin rights.

I'm interested in simply disabling the agent.    This may be frowned upon but still would be nice to know if this can be done.

Please sign in to leave a comment.