Sorry, we found 0 results. Please try another query.
Showing max 10 of results

Visual Studio Code Extension to see the Azure DevOps Agent Status

We are using Azure DevOps / Pipelines for build and release management in our team.
I wanted to have a quick look if the hosted build agent is currently free or in use, so I have created a Visual Studio Code Extension to display the info in the status bar.

/images/2019/devops-status.gif

DOWNLOAD EXTENSION

Extension

  • To get started you create a new project with yeoman: yo code
  • The docs are really helpful.
  • There are a lot of samples for the different use cases here

The source of my extension can be found here in my GitHub repo

DevOps API

To connect to the Azure DevOps REST API you need a personal access token, which can be obtained from https://dev.azure.com/YOUR_ORG -> Your Account -> Security

/images/2019/devops-pat.jpg

The API documentation can be found here.

The specific API I wanted to use is missing in the documentation which maybe means it is not for public use (yet?). However the DevOps portal is using the same API so it works for now:

GET https://dev.azure.com/[YOUR_ORG]/_apis/distributedtask/resourceusage?parallelismTag=Private&poolIsHosted=true&includeRunningRequests=true

The parameters are important to see all the running tasks from the hosted agents. The result contains a variable usedCount with the number of currently running jobs. However to get the details who is building what you need a second call to the details API, which comes back as a result from the first call. See here:

data.runningRequests[0].owner._links.self.href

To access the REST API you have to use BASIC auth with a dummy username and the PAT (personal access token) as the password as you can see here (I’m using the request HTTP client library to call the API).

Leave a comment




Loading...