1

I want to list all builds which have been executed on a TFS build agent during the last x days.

We are using TFS 15.117.27024.0. The build agents I would like to analyze are XAML build agents. I managed it to get a list of all build runs of a specific build definition (IBuildDetails), which unfortunately don't have the information on which agent the build was executed.

My approach so far is:

TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(collectionURI);
tfs.EnsureAuthenticated();
IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));
List<IBuildDefinition> definitions = buildServer.QueryBuildDefinitions(projectName);
IBuildDetail[] builds = definitions[0].QueryBuilds();
Console.WriteLine(builds[0].BuildAgentUri); // <- this does not exist

In the end I would like to have a list like this:

BuildAgent01
    Build_20190410.4 (finished 4 min ago)
    Build_20190410.3 (finished 3 min ago)
    Build_20190410.2 (finished 2 min ago)
    Build_20190410.1 (finished 1 min ago)
BuildAgent02
    Build_20190410.8 (finished 8 min ago)
    Build_20190410.7 (finished 7 min ago)
    Build_20190410.6 (finished 6 min ago)
    Build_20190410.5 (finished 5 min ago)

Does anyone know how to achieve this?

Tobi
  • 61
  • 6
  • 1
    take a look : https://stackoverflow.com/questions/55537664/azure-devops-get-release-definitions-by-agent-pool-id/55550925?noredirect=1#comment97836561_55550925 – Amit Baranes Apr 11 '19 at 16:38

0 Answers0