Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display the build status in pull requests in Azure DevOps

I would like to display the status of pipeline builds in Azure Pipelines in corresponding pull requests in Azure DevOps Repos.

I'd like to have some indicator which shows that a build succeeded of failed, like this (Note that this is a screenshot from the microsoft docs page, also mentioned below): PR status

In my research I came across different solutions, including the following ones:

  • Adding pull request build status to Github.
    • In the screenshots, there's a "Report build status" checkbox which doesn't exist (anymore?). Be aware that there's a GitHub-repo selected, so maybe the checkbox has never existed at all for the Azure DevOps Repos option.
  • https://learn.microsoft.com/en-us/azure/devops/repos/git/pull-request-status?view=azure-devops#pull-request-status.
    • It seems to be possible to do this with the help of the Status API, but I expect Azure DevOps to provide this feature natively for Azure DevOps Repos and Azure Pipelines, as things like this should be one of the main benefits of such an integrated system.
  • https://github.com/MicrosoftDocs/vsts-docs/issues/3104
    • I just came across this issue on GitHub. It seems to be a question/request for exactly this behaviour, but with no comments so far (as of today).
like image 438
Alex Avatar asked Apr 15 '19 11:04

Alex


People also ask

How will you get notified when changes are made to the pull request Azure DevOps?

You can subscribe to email alerts to be notified of changes in pull requests (PRs). By default, you're subscribed to several common PR notifications. For a complete list of default subscription notifications, see Out-of-the-box (OOB) or default subscriptions.

How do I see pull requests in Azure DevOps?

Select View > Team Explorer to open Team Explorer. You can also press Ctrl+\, Ctrl+M. From Home, select Pull Requests to view lists of PRs opened by you or assigned to you. To view the PR list in the Azure DevOps web portal, select Actions and then select Open in browser.

How do you trigger a build on Azure DevOps pull request?

Create a pull request trigger You can set up pull request triggers for both Azure Repos or GitHub repositories. From within your project, Select Pipelines > Releases, and then select your release pipeline. Under the Pull request trigger section, select the toggle button to enable it.

How do I find build number in release pipeline?

If you linked a build as release artifact, then you can use $(Build. BuildNumber) to get build number. If you have the issue, please provide the details of your release pipeline (Linked artifact, Docker push task setting, detail log).


1 Answers

The key is to configure the CI pipeline as a Build Validation requirement, in the Build Policies settings of your master branch.

When that's configured, the PR will automatically kick off a CI build, and display its status in the PR screen.

like image 149
Vince Bowdren Avatar answered Nov 16 '22 18:11

Vince Bowdren