Limit pull request approver permission on a directory level

Nik Blanchet July 14, 2015

One of our repositories is extremely large with many directories. This is largely due to an organic growth. While it is clear that we should refactor the code base, we are not prepared to at this time.

Often, the senior developers who have expertise and knowledge of one directory are completely ignorant about the contents of another. For example, we might have one directory that manages UI and another one that manages handling requests.

The problem arises with requiring approval for pull requests. It appears that the ability to approve a pull request is only available on a per-repository + per-branch basis. How do I get more granular than that? How do I allow a directory within a specific repository and branch have a different set of approvers than another directory within that same repository and branch?

3 answers

1 accepted

4 votes
Answer accepted
Mark McCormack _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 14, 2015

Nik,

Adaptavist have recently released a new Add-on to the Marketplace that should solve your particular use case called ScriptRunner for Stash. This Add-on does many things but the area your most interested in is the feature of enforcing mandatory approvers (users or groups) automatically.

This screenshot should show how you could configure the Auto Add Approver Event Handler to suit your needs for a repository called "big-repo" and a directory with the path matching the condition (note: there are other conditions or you can write your own groovy scripted condition):

Event_Handlers_-_Stash.png

On this occasion I've configured the user "Frank N Stein" and all members of the group "front-end-engineers" to be mandatory reviewers of all Pull Requests that match the repository and the conditional path (or directory).

There is also a video you can watch on our Adaptavist ScriptRunner Youtube Channel which runs you through the Auto Add Reviewer functionality.

I hope that helps but feel free to let us know if it doesn't. We'd be glad to try and help. The best way to raise a question is on our Product Support Service Desk Portal.

1 vote
TimP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 14, 2015

Hi Nik,

While you can't do this "out of the box", you could create a custom "merge check" plugin that would allow you to require certain developers approvals on PRs where certain paths have been modified. 

There's an excellent tutorial on merge checks in the Stash developer documentation here: https://developer.atlassian.com/stash/docs/latest/tutorials-and-examples/controlling-when-pull-requests-can-be-merged.html

Hope this helps!

cheers,

Tim

Tony Hall October 22, 2015

Tim - how do we log this as a feature we'd like to have incorporated in the core product?

Tim Crall
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 22, 2015

You can enter a request at jira.atlassian.com. Post a link here if you do so that people who see this and agree can vote for it.

Tony Hall October 22, 2015
0 votes
Tim Crall
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 14, 2015

I don't think you can do this with Stash.  Certainly not out of the box.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events