CODEOWNERS approval optional instead of required on MR
This is for GitLab 14.0.5-ee on-prem.
This is a continuation of what started as a question/discussion at https://forum.gitlab.com/t/why-is-the-code-owners-approval-optional-on-the-mr/56548.
I have a situation where a code owner is listed as an optional approver on an MR when she - for all I understand - should be a required approver as per the code owners file. The MR is against a protected branch but the "CODEOWNERS for protected branches" is not in play here as we don't have this feature.
Here’s .gitlab/CODEOWNERS
Notice how I do not use the caret ^ character.
# Documentation at https://docs.gitlab.com/14.0/ee/user/project/code_owners.html
# Files can be specified using the same kind of patterns you would use in the .gitignore file. It uses globbing
# patterns to match against file names.
/integration-messages/**/*.yaml @user-having-permission-to-approve
approval_state REST resource
Upon pulling the /projects/project_id/merge_requests/mr_id/approval_state resource from the API I noticed two things
- the code owners rule is there
- the
approvals_requiredfor that rule is set to 0 <- THIS to me is a bug
Stripped down version follows
{
"approval_rules_overwritten": true,
"rules": [
{
// regular rule here
},
{
"id": 44657,
"name": "/integration-messages/**/*.yaml",
"rule_type": "code_owner",
"eligible_approvers": [
{
"id": 189,
"username": "user-having-permission-to-approve",
"state": "active"
}
],
"approvals_required": 0,
"users": [
{
"id": 189,
"username": "user-having-permission-to-approve",
"state": "active"
}
],
"groups": [],
"contains_hidden_groups": false,
"section": "codeowners",
"source_rule": null,
"overridden": false,
"code_owner": true,
"approved_by": [],
"approved": true
}
]
}
Related issues
I checked #322513 (closed) and other related issues but none seem to apply.