How I can set default reviewers in GitLab Premium?
In Settings → General I have only Merge request (MR) approvals, not reviewers.
There is no such setting in the UI. If you think it would be useful to others, please file a feature request.
As a workaround, you could use the Merge requests API to set reviewers when creating the MR or by updating it after creation.
How you want to achieve the desired result depends on your workflow.
For example, you could have something subscribe to the project webhook which triggers a script that does the API call whenever it sees an open MR event.
Another option, if you run pipelines on MRs, you can have a job run a script which could set reviewers if none are already set via the API.
Yet another option would be to have a specified reviewer set when a merge request is created through the /assign_reviewer #user quick action by adding it to the default and all MR template files.
You can use "Default description template for merge requests" either via Settings->Merge Requests or via file in .gitlab/merge_request_templates to do it via a workaround. (Doc)
In the template you can use the chat code
/assign_reviewer #user1 #user2 #user3
to automatically assign user1, user2 and user3 as reviewers when creating a new MR.
Might be a useful workaround as this does not add you as a reviewer. (especially for gitlab free/CE 14.8+, as multiple reviewers are only available for Premium)
You could add a Reviewers section to your default MR template. Then persons will be notified with a Todo for the MR upon creation.
This should be in your default branch.
.gitlab/merge_request_templates/default.md
## What this MR does / why we need it
- description
- proof of work
## Reviewers
- [ ] Reviewed by #gitlabUser1
- [ ] Reviewed by #gitlabUser2
- [ ] Reviewed by #gitlabUser3
- [ ] Reviewed by #gitlabUser4
- [ ] Reviewed by #gitlabUser5
Thanks for your MR, you're awesome! :+1:
The user can then check the checkbox upon review which will change the MR history too.
Could you please try below
In Settings-->General-Merge Request Approvals.
Click on Add approval Rule.
Add Rule name as "Default", Approvals required, desired branch and add members under approvers.
These approvers would be your default reviewers for any Merge request.
Related
The gitlab project is hosted at my company and created from some common template. I am the maintainer of the project.
I made code change, committed the branch and, at gitlab page, I created the merge request. The problem is, the "Merge" button is greyed out and I do not receive approval request email, so I am stuck here and have to wait for my colleague to approve it before I can merge. Is there a way I can make the merge before that?
I already tried the following at the project setting.
At "Merge request approvals", there is a rule mandates the minimum number of approvals. I deleted my colleagues from approvers list, just left myself; I also changed the minimum number to 0.
"Prevent approval of merge requests by merge request author" is unchecked
"Prevent approval of merge requests by merge request committers" is unchecked
In "repository" --> "Protected branch", I added 2 rules, one for the default branch of the project and one for the branch I just committed. The content of both rules are same, "allowed to merge" and "allowed to push" are "Maintainer + developer" and, the key is, "code owner approval" is slide off.
But after all these, that "Merge" button at my merge request page is still disabled; the strange thing is, just above that button, I can see "Requires approval from Owners" is check marked.
Any suggestion?
GitLab's documentations say that a merge request can be updated to add one or more reviewers via the reviewer_ids property: https://docs.gitlab.com/ee/api/merge_requests.html#update-mr
What seems strange to me is that certain projects or merge requests or users seem to have the ability to add more than one reviewer to a merge request, while others can only have one reviewer. This is viewable in the UI at gitlab.com, with some merge requests having more than 1 reviewer (see screenshot below), while my free account only seems to allow 1 reviewer on a merge request.
Via the GitLab api, how can I detect whether a given merge request can support more than 1 reviewer? If not at the merge request level, is this something at the project or user level?
For some additional context, I'm working on building a VSCode extension for CodeStream to enable support for GitLab merge requests, and the ability to add reviewers is part of its functionality.
Is there a way for all future pull requests to be auto-completed once all branch policies have successfully passed? Can we set this on a branch level (e.g. all PR's targeting master), instead of doing this manually for every new PR?
Any way to set autocomplete for all future Pull request to a particular Branch say master
I am afraid there is no such a way to set autocomplete for all future Pull request to a particular Branch at this moment.
Many community members have submit the same request in our main suggestion forum:
Option to allow Auto-Complete to be the default option on new pull-requests
You could vote and add your comments for this feedback.
I have GitLab Starter which seems to mean that I am unable to restrict code approvers on a directory basis as everyone needs developer level access.
This is causing slight headaches.
Is there a way in GitLab that I can review who approved groups of merge requests? This way I can at least check after the fact that no one has approved code who should not have.
Is there a way to query the backend database or a way of gaining this information in some GUI screen somewhere?
There will be a way, with the upcoming GitLab 13.5 to clearly see the status of the approval process and who has approved a MR.
In the meantime, you still have the GitLab Merge Request approval API and the merge request API, with a call like GET /merge_requests does include paramters like approver_ids
Returns merge requests which have specified all the users with the given ids as individual approvers.
None returns merge requests without approvers.
Any returns merge requests with an approver.
That could help checking who has approved a MR.
Users on GitLab Starter, Bronze, or higher will also see the approvals_before_merge parameter.
so I want to get email notification for failed pipeline builds, I tried to configure my gitlab settings as following: https://docs.gitlab.com/ee/workflow/notifications.html
But in my settings I see following:
There is no check box for Failed/Successful pipeline.
For the project I set it to 'Watch:' receive notifications from projects or groups user is a member of.
What am I missing?
Even if the question is old, the solution is the Gitlab Integration "Pipeline emails" (suggested by this other answer).
In short, in your project, go to Project -> Settings -> Integrations -> Pipelines emails and set the list of emails to notify.
The link to https://docs.gitlab.com/ee/workflow/notifications.html is no more active.
I found a blog post from 2020 on https://about.gitlab.com/blog/, explaining how to do.
Read it there : https://about.gitlab.com/blog/2020/06/17/notification-on-pipeline-succeeds/
In short, you have checkboxes for custom notification events like :
failed pipeline
fixed pipeline
successful pipeline
etc.
To access it, like said in the blog post,
Go to the Project overview page for the project.
Click the "bell" 🔔 (Notification setting) button and select Custom.
And before all, check your global notification email at : https://gitlab.com/-/profile/notifications