I'm trying to build a report to show the relative efficiency of my various build agents and having trouble getting the info I need out of the tool.
What I'd like to have is a simple grid with the following columns:
- Build Number
- Build Definition
- Build Agent
- Build Status
- Build Start Time
- Build Duration
Which would let me do something like chart the duration of successful builds of a given build definition on agent1 against the same build definition on agent2 through agentN.
How would I go about this?
The build agent information isn't always in the same place.
I found it for a build I was looking at in buildInformationNodes[1].Children.Nodes[2].Fields["ReservedAgentName"]. The following seems to work for me (so far).
My initial intention was to point you to TFS OLAP Cube & describe how you could retrieve what you were after. Then I realized that the cube does not provide with the info which Agent built what Build.
Then I thought it would be simple to write a small TFS-console app that print the infos you 're after:
This won't compile, since
Eventually I dove into the
IBuildInformationNode[]
and got the build agent as follows:The try-catch is necessary, so you can deal with builds that failed/stopped before agent-selection.
If you use this latter part as a substitute to the failing
Console.Write(buildDetail.BuildAgent.Name+"\t");
you should end up with a console app, whose output can be piped into a *.CSV file & then imported to Excel.The following code should help in getting the Build Agent Name for the given build detail.
Make sure that you have refresh the build information in the build details object.You can do so by the either calling the following code on your build Details object before getting the build agents
Hope it helps :)