Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
83a59912
Commit
83a59912
authored
Jul 20, 2020
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove skip_web_ui_code_owner_validations feature flag
parent
c8d4dfba
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
54 deletions
+3
-54
ee/lib/ee/gitlab/checks/diff_check.rb
ee/lib/ee/gitlab/checks/diff_check.rb
+1
-12
ee/spec/lib/gitlab/checks/diff_check_spec.rb
ee/spec/lib/gitlab/checks/diff_check_spec.rb
+2
-42
No files found.
ee/lib/ee/gitlab/checks/diff_check.rb
View file @
83a59912
...
@@ -20,22 +20,11 @@ module EE
...
@@ -20,22 +20,11 @@ module EE
end
end
def
validate_code_owners?
def
validate_code_owners?
return
false
if
updated_from_web?
&&
skip_web_ui_code_owner_validations?
return
false
if
updated_from_web?
project
.
branch_requires_code_owner_approval?
(
branch_name
)
project
.
branch_requires_code_owner_approval?
(
branch_name
)
end
end
# To allow self-hosted installations to ignore CODEOWNERS rules when
# clicking Merge in the UI. By default, these rules are not skipped.
#
# Issue to remove this feature flag:
# https://gitlab.com/gitlab-org/gitlab/-/issues/217427
def
skip_web_ui_code_owner_validations?
return
true
unless
::
Feature
.
enabled?
(
:use_legacy_codeowner_validations
)
::
Feature
.
enabled?
(
:skip_web_ui_code_owner_validations
,
project
)
end
def
validate_code_owners
def
validate_code_owners
lambda
do
|
paths
|
lambda
do
|
paths
|
validator
=
::
Gitlab
::
CodeOwners
::
Validator
.
new
(
project
,
branch_name
,
paths
)
validator
=
::
Gitlab
::
CodeOwners
::
Validator
.
new
(
project
,
branch_name
,
paths
)
...
...
ee/spec/lib/gitlab/checks/diff_check_spec.rb
View file @
83a59912
...
@@ -125,52 +125,12 @@ RSpec.describe Gitlab::Checks::DiffCheck do
...
@@ -125,52 +125,12 @@ RSpec.describe Gitlab::Checks::DiffCheck do
expect
(
subject
).
to
receive
(
:updated_from_web?
).
and_return
(
true
)
expect
(
subject
).
to
receive
(
:updated_from_web?
).
and_return
(
true
)
end
end
context
"when use_legacy_codeowner_validations is enabled"
do
before
do
stub_feature_flags
(
use_legacy_codeowner_validations:
true
)
end
context
"when skip_web_ui_code_owner_validations is disabled"
do
before
do
stub_feature_flags
(
skip_web_ui_code_owner_validations:
false
)
allow
(
project
).
to
receive
(
:branch_requires_code_owner_approval?
)
.
once
.
and_return
(
true
)
end
it
"returns an array of Proc(s)"
do
validations
=
subject
.
send
(
:path_validations
)
expect
(
validations
.
any?
).
to
be_truthy
expect
(
validations
.
any?
{
|
v
|
!
v
.
is_a?
Proc
}).
to
be_falsy
end
context
"when skip_web_ui_code_owner_validations is enabled"
do
before
do
stub_feature_flags
(
skip_web_ui_code_owner_validations:
true
)
expect
(
project
).
not_to
receive
(
:branch_requires_code_owner_approval?
)
end
it
"returns an empty array"
do
expect
(
subject
.
send
(
:path_validations
)).
to
eq
([])
end
end
end
end
context
"when use_legacy_codeowner_validations is disabled"
do
before
do
stub_feature_flags
(
use_legacy_codeowner_validations:
false
)
expect
(
project
).
not_to
receive
(
:branch_requires_code_owner_approval?
)
end
it
"returns an empty array"
do
it
"returns an empty array"
do
expect
(
subject
.
send
(
:path_validations
)).
to
eq
([])
expect
(
subject
.
send
(
:path_validations
)).
to
eq
([])
end
end
end
end
end
end
end
end
end
context
'file name rules'
do
context
'file name rules'
do
# Notice that the commit used creates a file named 'README'
# Notice that the commit used creates a file named 'README'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment