Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge request approvals settings of group #701

Open
rogierlommers opened this issue Mar 6, 2024 · 4 comments
Open

Merge request approvals settings of group #701

rogierlommers opened this issue Mar 6, 2024 · 4 comments
Labels
✨feature request gitlab-premium This feature would support GitLab Premium and above tiers help wanted

Comments

@rogierlommers
Copy link

rogierlommers commented Mar 6, 2024

Hey! First of all, I like your project. We're playing a bit with our gitlab configurations and how to apply it within the organization. The documentation is quite clear for us, but there is one thing I don't really understand. Basically the question is: how do I change the settings in the screenshot below (so on group level).

Screenshot 2024-03-06 at 14 50 11

We want to set the request-approval-rules on a group basis. This setting should be inherited to all the groups/projects that will be created inside this group. is this possible?

With the code snippet below i can "walk through" all repositories and change the settings after creation. However, I want to avoid that new projects/repos have the setting prevent approval by author to value false.

---
config_version: 3
gitlab:

projects_and_groups:
  '*':
    merge_requests_approvals:
      reset_approvals_on_push: false
      merge_requests_author_approval: true
      disable_overriding_approvers_per_merge_request: true
@rogierlommers
Copy link
Author

rogierlommers commented Mar 7, 2024

A bit more information: it turns out that the gitlab API does support these operations:

[EDIT]

curl --header "PRIVATE-TOKEN: xxx" --header "Content-Type: application/json" -X PUT  --data  <<SEE BELOW>>'' https://gitlab/api/v4/groups/25459/merge_request_approval_setting

REQUEST BODY

{
   "require_password_to_approve":false,
   "allow_author_approval":false,
   "allow_overrides_to_approver_list_per_merge_request":false,
   "require_password_to_approve":false,
   "retain_approvals_on_push":false,
   "selective_code_owner_removals":false,
   "allow_committer_approval":false
}

@amimas
Copy link
Collaborator

amimas commented Mar 9, 2024

Hi 👋 . Based on your latest comment, I think you want to manage "merge request approval" setting in a group. Please confirm. If that's the case, I believe this is not supported by gitlabform at the moment. You'll find the gitlabform docs on this setting specifying that the available config is for a project level setting.

With the code snippet below i can "walk through" all repositories and change the settings after creation. However, I want to avoid that new projects/repos have the setting prevent approval by author to value false.

To me, the above is a bit confusing. Even if you configure the setting in a group manually (without gitlabform), it will be inherited by all projects under that group. I'm not aware of any option to control the setting to not be applied on newly created projects after this setting is configured.

Anyways, PR is welcome for adding support for group level configuration of merge request approval setting. Will you be able to contribute this feature?

@amimas amimas changed the title Being able to set merge request approvals on group level Merge request approvals settings of group Mar 15, 2024
@amimas amimas added ✨feature request gitlab-premium This feature would support GitLab Premium and above tiers help wanted labels Mar 15, 2024
@amimas
Copy link
Collaborator

amimas commented Mar 17, 2024

A bit more information: it turns out that the gitlab API does support these operations:

[EDIT]

curl --header "PRIVATE-TOKEN: xxx" --header "Content-Type: application/json" -X PUT  --data  <<SEE BELOW>>'' https://gitlab/api/v4/groups/25459/merge_request_approval_setting

Could you please point to the API doc? I was looking at following doc page and it didn't show the API endpoint from your example, although it showed up from their search. Also, some of the data in your example doesn't seem to exist on this page. Wondering if I'm looking at the wrong page or they have an issue with their documentation.

https://docs.gitlab.com/ee/api/merge_request_approvals.html

@rogierlommers
Copy link
Author

Will do later-on, a bit time constraint now. Will follow-up asap. Thanks, @amimas !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨feature request gitlab-premium This feature would support GitLab Premium and above tiers help wanted
Projects
None yet
Development

No branches or pull requests

2 participants