Branch Policy: Require atleast 1 Approval from specified approvers
Asked Answered
G

2

5

We have 6 people on the project team: 1 Tech-lead and 1 Assistant Tech-lead.

In our branch policy we want to require that only the Tech-lead or Assistant Tech-lead can approve the pull request. We only need approval from one of them to avoid a bottleneck if the other one is on leave.

The problem is there are only 2 choices in the branch policy settings:

  1. Specifying the number of required approvers (which will not work since normal developers would be able to approve as well)
  2. Specifying the actual person to approve (which will not work since both of them will be required and cause a bottleneck when one is on leave)

Can someone please point us in the right direction?

Gravois answered 2/8, 2018 at 2:29 Comment(0)
D
14

You can provide required reviewers that are automatically added to each PR. These reviewers can also be groups.

Do this:

  1. Create a group that contains your tech lead and assistant tech lead and.
  2. Make that group a required approver under Automatically include code reviewers

You should get something like this: enter image description here

Your statement normal developers would be able to approve as well is only true if the group that is required contains your normal developers.

This way at least 1 person from provided group (in this case Developers) must approve a PR. If you want you can also provide a path filter to require only reviews on certain changes or assign a different group for files or folders.

Doubt answered 2/8, 2018 at 3:27 Comment(3)
Edited your answer adding a screenshot to it.Cystoid
Oooh that makes sense. I know this is additional to the question but lets say we add in another assistant techlead. We now have 3 reviewers but I now need at least 2 person to approve. (We don't have this setup right now but just asking for future references.) Accepting your answer as correct though. Thank youGravois
You can simply change the number of required reviewers to 2. That means that at least 2 people review it. Have a look at the docs here: learn.microsoft.com/en-us/vsts/repos/git/…Cystoid
H
0

for those who are on Bitbucket:

These are available under Repository Settings->Workflow->Branch Permissions

enter image description here

Hong answered 7/2, 2022 at 23:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.