简体   繁体   English

Azure Devops 需要构建成功才能完成拉取请求

[英]Azure Devops Require Build Success before Pull Request can be completed

I would like to enforce a policy on my Pull Requests in Azure Devops (using Azure Repositories) to only allow a PR to be complete IFF the build definition succeeds.我想在 Azure Devops(使用 Azure 存储库)中对我的拉取请求执行一项策略,以仅在构建定义成功的情况下允许 PR 完成。 Based on this documenation: https://docs.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops and what I have tested so far the builds only trigger after the PR is marked complete.基于此文档: https://docs.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops以及到目前为止我测试过的构建仅在 PR 之后触发被标记为完成。 So in the event that a build failure occurs, the broken code makes it into the master (or target branch).因此,如果发生构建失败,损坏的代码会使其进入主分支(或目标分支)。 I'd like to disable the ability to complete a PR until the Build Succeeds.我想禁用在构建成功之前完成 PR 的功能。 This was possible in Team Foundation Server but I have not been able to set this up in Azure Devops.这在 Team Foundation Server 中是可能的,但我无法在 Azure Devops 中进行设置。

I have reviewed the Branch Policies section and it is clear how to require a review/approval from a member of a specific group prior to allowing the PR to be marked Complete.我已经审查了分支政策部分,并且很清楚如何在允许将 PR 标记为 Complete 之前要求特定组的成员进行审查/批准。 So the hooks seem to exist, however, I have only been able to trigger a build definition AFTER the build is marked Complete.所以钩子似乎存在,但是,我只能在构建标记为完成后触发构建定义。

Require a certain build to run with your PR需要特定的构建才能与您的 PR 一起运行

The " Build Validation " section of the link you mentioned does exactly what you describe.您提到的链接的“ 构建验证”部分完全符合您的描述。

  1. Go to the branch policies of the master(target) branch Go 到主(目标)分支的分支策略
  2. Select the build you want to enforce and select "required" Select 您要执行的构建和 select “必需”

Set a policy requiring changes in a pull request to build successfully with the protected branch before the pull request can be completed.设置一个策略,要求在拉取请求完成之前使用受保护的分支成功构建拉取请求中的更改。

edit: this is how it looks like afterwards:编辑:这就是它之后的样子: 在此处输入图像描述

Require a certain user to review/approve要求特定用户审核/批准

Look at the section " automatically include code reviewers ".查看“ 自动包含代码审阅者”部分。

If you select Required next to a path entry, then the pull request cannot be completed until:如果您在路径条目旁边需要 select ,则拉取请求无法完成,直到:

  • Every user added as a reviewer for the path approves the changes.添加为路径审阅者的每个用户都会批准更改。
  • At least one person in every group added to the path approves the changes.添加到路径的每个组中至少有一个人批准更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM