As a TFS administrator one of the questions I get asked frequently is why someone’s build seems to be stuck in queue. Our TFS deployment has quite a few machines that each have a single build agent and build controller installed on them. To complicate things further, we have a few dozen different team project collections in TFS.
Since you can only view builds queued up from a single team project, finding the source of these issues has always been a bit annoying. You would have have to iterate through each of the team projects, then view thequeuedbuilds in each team project until u found the culprit. Depending on the number of team projects and builds, this could be a very time consuming task.
Generally speaking, I would just write back and let them know I was keeping an eye on things and that they should just be patient for the build queue to clear itself up. But every now and then, something would hang indefinitely and the possibility of that always hung out in the back of my mind.
Thankfully, I found an article on Bart Wullem’s blog, The Art of Simplicity, that set me off on the right direction: a console application that got all of the queued build information from the TFS API and wrote it out to the screen. Even better, the source code to the console app was published too.
I made a few changes; instead of hard coding the TFS URL into the app I added a config file and put the URL in there so that you could easily change it, I prettied up the output a little bit by sorting the builds by the Build Controller it’s assigned to and then by the time it was queued, and lastly I added an elapsed time to the output.
In following Bart’s example, I thought I’d share this and save another TFS administrator the effort I went through:
Update (12/28/2011): Fixed an issue where queued builds caused the application to crash.