Is it possible to enforce merge checks for an approval from a member from each team?

Adam Piper March 16, 2022

First of all, does bitbucket support teams?

We have a component library that several teams are working on. It would be a 'nice to have' feature if we could enforce a merge check to ensure that at least one member from each team has approved a PR.

Is this possible at the moment in Bitbucket? I know Jira has teams, but I haven't seen support for this in Bitbucket.

Thanks for any help in advance!

2 answers

1 accepted

1 vote
Answer accepted
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 16, 2022

Hi @Adam Piper ,

welcome to the Atlassian community!

You could put in place that behaviour using builtin features.

  1. Setup default reviewers per project basis as specified here https://support.atlassian.com/bitbucket-cloud/docs/add-default-reviewers-to-a-project/
  2. Define merge check policies and in particular "Check for at least # approvals" as specified here https://bitbucket.org/blog/protect-your-master-branch-with-merge-checks#:~:text=In%20Bitbucket%20Cloud%2C%20merge%20checks,on%20Free%20or%20Standard%20plans.&text=Users%20get%20notified%20when%20pull,have%20that%20number%20of%20approvals.&text=Users%20get%20notified%20when%20they%20have%20open%20pull%20request%20tasks.&text=Users%20get%20notified%20when%20they%20don't%20have%20that%20number,for%20the%20most%20recent%20commit.

Does it meet your requirments? Currently teams, if managed as user groups, can be reused at bitbucket level for dfault reviewers configuration.

Moreover, if you need to check merge approvals in a structured way, my suggestion is to try the following app https://marketplace.atlassian.com/apps/1211303/workzone-pullrequest-workflow?hosting=cloud&tab=overview

Hope this helps,

Fabio

Adam Piper March 18, 2022

Hi Fabio,

Thanks a lot for your welcome, and for your answer.

I suppose I was looking for something more along the lines of we have our default reviewers, and then on top of that we have a merge check for someone from each team. However, the users on each team are not necessarily default reviewers.

This way it would allow us to keep a strict list of repository maintainers that may be fewer than the number of teams working on the repository.

If this is not possible then I think your solution is probably the best we could get. We will just have to select someone from each team to be a default reviewer.

The idea behind this is that we will only allow default reviewers to merge into the main branch, but need the approval of someone from each team before the merge can actually take place.

The app that you have provided does look like it could fulfil our needs, so I may give that a go!

Thanks again,

Adam

Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 18, 2022

you're welcome @Adam Piper 

0 votes
Roman Stoffel January 20, 2023

Hello

You also can achieve something like this with Code Owner for Bitbucket.

You define your teams in the Code Owners file. And then enforce that each team needs at least one approval:

```

# Team definitions
@@@UITeam @"Jim Dev" @"Jill Dev"
@@@BackendTeam @"Coffee Joe" @"Jim Dev" @"Jordan Dev"
@@@ToolsTeam @"Joe Dev" @"Lee Dev"
@@@SecurityTeam @"Alice" @"Bob"

# What source code is owned by who:
src/** @@UITeam @@BackendTeam @@ToolsTeam @@SecurityTeam

# At least one developer of each team has to approve
(Check(@@UITeam>=1) & Check(@@BackendTeam>=1) & Check(@@ToolsTeam>=1) & Check(@@SecurityTeam>=1)& Check(@@SecurityTeam>=1))```

 

More details in the docs.

Cheers
Roman

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events