4

I love GitLab, but I am frustrated to assign approvers manually for each Merge Request. Gitlab friendly suggest to Tip: add a CODEOWNERS to automatically add approvers based on file paths and file types. And so I did , I have created a file under : .gitlab/docs/CODEOWNERS.txt Here is the contents of my file :

Multiple codeowners can be specified, separated by whitespace

CODEOWNERS @eduardo.baiao @n.belokopytov @viacheslav.iankovyi @yan.braslavsky

But unfortunately it does not auto assigns reviewers during Merge Requests. Did I do something wrong ? Am I missing something ?

2 Answers 2

5

Assigning approvers based on a CODEOWNERS file requires either GitLab Premium or GitLab Silver (or higher).

  • According to the Code Owners documentation, the CODEOWNERS file should be placed in either .gitlab/ or docs/ or the root directory. I don't think it will find it in .gitlab/docs.
  • Additionally, the docs specify that the file should be named CODEOWNERS, not CODEOWNERS.txt. Try removing the .txt extension and see if it works.
  • Make sure that you have "Require approval from code owners" enabled in Settings -> General -> Merge Request Approvals. Merge Request Approvals
Sign up to request clarification or add additional context in comments.

2 Comments

Note that "Require approval from code owners" has been moved to Settings -> Repository -> Protected Branches.
Even if I have all the listed requirements fulfilled and the relevant code owners are correctly and automatically listed in merge requests, they are still not auto-assigned to be reviewers.
5

Looks like there is a confusion in the previous answers here between

  • approvers: the people that can click on 'Approve' to get the MR in a merge-able state. Potentially this list can be very long in a big company.
  • reviewers: a (usually) much shorter list of people you're asking to review this MR.

As a further clarification, I guess that the OP would like to choose the reviewers in the pool of approvers.

The OP is asking if Gitlab provides a feature to auto-choose reviewers, given the approval rules that apply to the current MR. Sadly, AFAIK, the answer is no.

However, you might want to look at what Gitlab itself is doing internally: their job danger-review leverages a library danger (https://danger.systems/js/) to run their "Reviewer Roulette": a process that assigns reviewer to a given MR (but I don't know if they take approval rules into account when doing so)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.