user3216649
user3216649

Reputation: 81

Get a list of builds/releases for an agent pool?

Is there a way (via powershell, Azure DevOps' REST api, or via the UI) to pull a list of builds/releases run in the past X time on a specific Agent Pool? I haven't found any documentation to indicate a method yet.

Upvotes: 1

Views: 2014

Answers (1)

Leo Liu
Leo Liu

Reputation: 76670

Get a list of builds/releases for an agent pool?

There is no such out-of-the-box API at this moment, because the agent REST API is undocumented, see REST API Overview for Visual Studio Team Services and Team Foundation Server for more information.

However you could use tools such as Fiddler to track the the API, following below steps to get list of builds/releases for an agent pool with REST API:

  1. Get Pool ID:

    GET https://dev.azure.com/<YouOrganizationName>/_apis/distributedtask/pools/

    enter image description here

  2. Get Agent ID based on the pool ID:

    GET https://dev.azure.com/<YouOrganizationName>/_apis/distributedtask/pools/5/agents/

    enter image description here

  3. Get the job requests the specific Build Agent:

    GET https://dev.azure.com/<YouOrganizationName>/_apis/distributedtask/pools/5/jobrequests?agentId=4

    enter image description here

Now, we could use scripts to list the those builds/releases info, like, "requestId", "result" and so on.

The helped ticket: Retrieving a list of agent requests from TFS REST API

Note:

These are undocumented so you should be vigilant while upgrading your TFS if you are taking dependencies on these.

Hope this helps.

Upvotes: 5

Related Questions