Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSTS Extension - Get build URL

I'm developing a VSTS extension in Javascript.

In one of my tasks, I need to get a link to my build results. I tried to read from {$Build.BuildUri} but it gives me vstfs:///Build/Build/{buildId} and not a real link.

How can I get a direct link to my build results? I need it both in build and in release pipelines.

like image 962
yahavi Avatar asked Aug 29 '18 07:08

yahavi


People also ask

How do I get Azure DevOps server URL?

With the introduction of Azure DevOps Services, organizational resources and APIs are now accessible via either of the following URLs: https://dev.azure.com/{organization} (new) https://{organization}.visualstudio.com (legacy)

Where is Azure DevOps Server Extensions page?

Open your Azure DevOps Server home page ( https://{server}:DefaultCollection ). Open the extensions menu and choose Browse Marketplace. Find the extension that you want to install. Use the search box to filter the list of extensions.

How do I connect to Azure DevOps with App Center?

To be able to publish your package in App Center we need to authorize Azure DevOps to be able to connect to it. To do that, go to App Center and inside your Profile > Account Settings > API Tokens, create a New API Token and be sure to give your key the Full Access.

How do you get Azure DevOps from Azure portal?

You must sign in with your Azure AD account. If you don't have one, create a GitHub account now. Go to Azure DevOps and select Start free with GitHub. Enter your account credentials and go through the sign-up process.


1 Answers

The build result page use the URL formatted as below:

https://{vstscollectionuri}/{projectname}/_build/results?buildId={buildid}&_a=summary

And you can get these information via the Predefined Build Variables during the build. In your build task, get the following variables and then combine them to the build result URL.

  • System.TeamFoundationCollectionUri
  • System.TeamProject
  • Build.BuildId
like image 95
Eddie Chen - MSFT Avatar answered Oct 15 '22 11:10

Eddie Chen - MSFT