I was having a problem with VSO Build.Preview / Build.VNext builds not being picked up by my self hosted VSO build agent (on an Azure VM). Unfortunately this is the 2nd or 3rd time I have hit into this problem, hence I felt a blog post was in order. When queuing a build I was greeted with the message “this build has been queued and is waiting to start”, this is normal at the start of every build, what is not normal is for this to not move on and sit there permanently.
- The first thing I always check in this situation is that the build server is available and enabled in VSO at https://YOURCOMPANYNAME.visualstudio.com/DefaultCollection/_admin/_AgentQueue, both were and my build agent was “Green”.
- I then RDP’d to the build sever to establish if the VSO agent was active in the processes tab, it was. I then kicked off another build and could instantly see activity on the agent, but this soon died off and I was again left with the above issue.
- I then prompted an update of the agent by visiting https://YOURCOMPANYNAME.visualstudio.com/DefaultCollection/_admin/_AgentQueue and selecting the queue on the left hand menu and selecting “Update all Agents”. I then repeated point 1 and 2, still no luck.
- Reboot the build server, tried step 1 and 2 again, still no luck.
- I found this article on msdn that described my exact issue, but that seemed to suggest this was a one off event related to a VSO update. So I left everything alone over night and tried the next day, same again. Coincidently, or not, I only ever appear to have these issues after Microsoft have rolled out a VSO update, to date I have not seen this outside the VSO update ship window.
At this stage I had no choice, I had to reinstall the agent.
Reinstall the Agent
- Go to https://YOURCOMPANYNAME.visualstudio.com/DefaultCollection/_admin/_AgentQueue and delete the build agent in your queue.
- Logon to your build sever, navigate to windows service explorer and locate the windows service “VSO Agent” (this name is dependent on if you accepted the default settings at point of install). Stop this service and then right click the service and go to properties, from here note down the install location of the service.
- Before we are reinstall the agent we require to delete the workspace that the agent was using. To do this open a developer command prompt (type cmd in the start menu and select the Visual Studio cmd prompt) and run the below commands to list and then delete the required workspaces.
tf workspaces /server:https://YOURCOMPANYNAME.visualstudio.com/DefaultCollection
from the above output note down the workspace and the owner and then execute
tf workspace /delete /server:https://YOURCOMPANYNAME.visualstudio.com/DefaultCollection “workspacename;owner”
Note the semi colon between workspacename and owner
4. Now open up windows explorer and navigate to the directory you noted down at step 3 and you will find in the agent folder a script named “ConfigureAgent.cmd”. Open a command prompt, navigate to this directory and run this cmd file.
5. You will be prompted if you wish to update the local agents settings, say yes then accept all default options (your settings should already be stored from the previous install).
6. Now try another build. For me this was all I had to do, if it still does not work at this point I would suggest repeating steps 1-3 before downloading a fresh agent from VSO.