Compatible agent details in REST API

If I look at /buildQueue/id:12345/compatibleAgents there's one <agent> element

However, checking /viewQueued.html?itemId=12345&buildTypeId=TestBuild&tab=queuedBuildCompatibilityTab shows far more detailed information (compatible agents, incompatible agents together with the reason, compatible / incompatible agents in other pools).

Is the extra information available via the API?

7 comments
Comment actions Permalink

Hi Michael,

It's only possible to get the list of compatible agents using REST API.
How do you plan to use the information on compatibility?

0
Comment actions Permalink

I'm looking at doing some metrics reporting. The false positives are causing problems e.g. where the API will report 6 agents are compatible but the web page shows that only 1 agent will be able to run the build because the other 5 are part of pools not associated with the project. I need access to that information.

0
Comment actions Permalink

Thank you for details. I created a bug report https://youtrack.jetbrains.com/issue/TW-43472. Please watch/vote for it.

0
Comment actions Permalink

Alina,

I've done a bit more investigating and it looks like extensions of jetbrains.buildServer.controllers.BaseController have access to the information. In the REST API it would be something like /httpAuth/app/rest/buildQueue/id:XXX/incompatibleAgents:

BuildQueue builds = myServer.getQueue();
SQueuedBuild build = builds.findQueued(id);
if(build != null) {
     Map map = build.getCompatibilityMap();
     for(Entry entry : map.entrySet()) {
          SBuildAgent agent = entry.getKey();
          CompatibilityResult result = entry.getValue();
          if(!result.isCompatible()) {
               // Add result.getInvalidRunParameters(), result.getMissedVcsPluginsOnAgent(),
               // result.getNonMatchedRequirements(), result.getUndefinedParameters() to response
          }
     }
}


Does that make sense?

0
Comment actions Permalink

Hi Michael,

Thank you for the prototyle code. BTW, it is possible to write a TeamCity plugin which will expose the data as you want it.

Do you need to analyze compatibility of a specific build in the queue or the build configuration? The latter seems to be a more common task as you do not need to trigger a build to get the compatibility details.

According to the comment, TeamCity 9.1 has experimental support for getting compatibility information for an agent and also for the list of agents. That does not (yet) support details about incompatibility reason, only textual description.
However, you might be able to retrieve the information you need based on that.

0
Comment actions Permalink

Yegor,

Thanks for the info. When you say "write a TeamCity plugin which will expose the data" do you mean I can invent new bits of the API? Or do I need my own URL.

0
Comment actions Permalink

> When you say "write a TeamCity plugin which will expose the data" do you mean I can invent new bits of the API? Or do I need my own URL.

It is possible to add handling for new sub-URLs to REST API. For example here is the code adding .../app/rest/cctray URL handling.

0

Please sign in to leave a comment.