Include sleeping cloud agents in pool information from REST API?

Using a query like "app/rest/agents?locator=pool:id:12", the REST API will give me information about agents in a pool. Using locators like "connected:false" can include agents in different states.

But we have Azure Cloud Agents that sleep when unutilised and automatically start when builds for their pool are queued. I cannot find any locator that will cause the query to tell me about agents in these states. In the TeamCity Web UI, they are not listed as available or disconnected or unauthorised, but they are listed under the pool details, with a special cloud icon next to them.

Once an Azure Cloud Agent has started, the REST API gives its details in the normal way. But this is no use if one wants to use the REST API to find out which agents one could submit a job to, as this should definitely include agents that are asleep but would start automatically were a job queued to them.

Is there any way to get the REST API to include sleeping cloud agents information for a pool?

1 comment
Comment actions Permalink

For anybody who might find this of interest, we handled this issue internally. With TeamCity 2019.2 we released several cloud endpoints:

app/rest/cloud/images

app/rest/cloud/instances

app/rest/cloud/profiles

 

This have mostly GET methods to read information but have also some other basic management methods that we plan on expanding on in the future.

 

For the specific task, cloud profiles generate their own pool internally. This pool has a known project attached called "ownerProject". Information about it can be found with this request:

<url>/app/rest/agentPools/id:<id>?fields=*,ownerProject(cloudProfiles(cloudProfile(*)))

 

0

Please sign in to leave a comment.