TFS build duration report by agent

后端 未结 3 937
闹比i
闹比i 2021-01-06 15:15

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 t

3条回答
  •  离开以前
    2021-01-06 15:42

    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).

    private static string GetAgentName(IBuildDetail buildDetail)
    {
       string agentName = "Unknown";
       bool fAgentFound = false;
    
       try
       {
          foreach (IBuildInformationNode node in buildDetail.Information.Nodes)
          {
             foreach (IBuildInformationNode childNode in node.Children.Nodes)
             {
                if (childNode.Fields.ContainsKey("ReservedAgentName"))
                {
                   agentName = childNode.Fields["ReservedAgentName"];
                   break;
                }
             }
             if (fAgentFound) break;
          }
    
       }
       catch (Exception ex)
       {
          // change to your own routine as needed
          DumpException(ex);
       }
       return agentName;
    }
    

提交回复
热议问题