Commit 1bff8ba9 authored by Igor Drozdov's avatar Igor Drozdov

Merge branch 'remove_push_rules_supersede_code_owners_feature_flag' into 'master'

Remove push_rules_supersede_code_owners feature flag

See merge request gitlab-org/gitlab!45323
parents 0097a258 c89a6b45
---
name: push_rules_supersede_code_owners
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44126
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/262019
type: development
group: group::source code
default_enabled: false
...@@ -75,7 +75,6 @@ be used for merge request approvals: ...@@ -75,7 +75,6 @@ be used for merge request approvals:
- As [merge request eligible approvers](merge_requests/merge_request_approvals.md#code-owners-as-eligible-approvers). - As [merge request eligible approvers](merge_requests/merge_request_approvals.md#code-owners-as-eligible-approvers).
- As required approvers for [protected branches](protected_branches.md#protected-branches-approval-by-code-owners). **(PREMIUM)** - As required approvers for [protected branches](protected_branches.md#protected-branches-approval-by-code-owners). **(PREMIUM)**
NOTE: **Note:**
Developer or higher [permissions](../permissions.md) are required in order to Developer or higher [permissions](../permissions.md) are required in order to
approve a merge request. approve a merge request.
...@@ -93,12 +92,14 @@ to specify the actual owners and granular permissions. ...@@ -93,12 +92,14 @@ to specify the actual owners and granular permissions.
Using Code Owners in conjunction with [Protected Branches](protected_branches.md#protected-branches-approval-by-code-owners) Using Code Owners in conjunction with [Protected Branches](protected_branches.md#protected-branches-approval-by-code-owners)
will prevent any user who is not specified in the `CODEOWNERS` file from pushing will prevent any user who is not specified in the `CODEOWNERS` file from pushing
changes for the specified files/paths, even if their role is included in the changes for the specified files/paths, except those included in the
**Allowed to push** column. This allows for a more inclusive push strategy, as **Allowed to push** column. This allows for a more inclusive push strategy, as
administrators don't have to restrict developers from pushing directly to the administrators don't have to restrict developers from pushing directly to the
protected branch, but can restrict pushing to certain files where a review by protected branch, but can restrict pushing to certain files where a review by
Code Owners is required. Code Owners is required.
[Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35097) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.5, users and groups who are allowed to push to protected branches do not require a merge request to merge their feature branches. Thus, they can skip merge request approval rules, Code Owners included.
## The syntax of Code Owners files ## The syntax of Code Owners files
Files can be specified using the same kind of patterns you would use Files can be specified using the same kind of patterns you would use
......
...@@ -185,6 +185,8 @@ When enabled, all merge requests targeting these branches will require approval ...@@ -185,6 +185,8 @@ When enabled, all merge requests targeting these branches will require approval
by a Code Owner per matched rule before they can be merged. by a Code Owner per matched rule before they can be merged.
Additionally, direct pushes to the protected branch are denied if a rule is matched. Additionally, direct pushes to the protected branch are denied if a rule is matched.
[Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35097) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.5, users and groups who are allowed to push to protected branches do not require a merge request to merge their feature branches. Thus, they can skip merge request approval rules.
## Running pipelines on protected branches ## Running pipelines on protected branches
The permission to merge or push to protected branches is used to define if a user can The permission to merge or push to protected branches is used to define if a user can
......
---
title: Allow 'allowed_to_push' to supersede code owner protected branch
merge_request: 45323
author:
type: changed
...@@ -20,8 +20,7 @@ module EE ...@@ -20,8 +20,7 @@ module EE
end end
def validate_code_owners? def validate_code_owners?
return false if updated_from_web? return false if updated_from_web? || user_access.can_push_to_branch?(branch_name)
return false if ::Feature.enabled?(:push_rules_supersede_code_owners, project) && user_access.can_push_to_branch?(branch_name)
project.branch_requires_code_owner_approval?(branch_name) project.branch_requires_code_owner_approval?(branch_name)
end end
......
...@@ -60,18 +60,6 @@ RSpec.describe Gitlab::Checks::DiffCheck do ...@@ -60,18 +60,6 @@ RSpec.describe Gitlab::Checks::DiffCheck do
it 'returns false' do it 'returns false' do
expect(validate_code_owners).to eq(false) expect(validate_code_owners).to eq(false)
end end
context 'when push_rules_supersede_code_owners is disabled' do
before do
stub_feature_flags(push_rules_supersede_code_owners: false)
end
it 'returns branch_requires_code_owner_approval?' do
expect(project).to receive(:branch_requires_code_owner_approval?).and_return(true)
expect(validate_code_owners).to eq(true)
end
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment