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
b1c6535f
Commit
b1c6535f
authored
Jul 06, 2020
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make QA maintainer mandatory if MR is only QA and author is an SET
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
74af310d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
11 deletions
+19
-11
danger/roulette/Dangerfile
danger/roulette/Dangerfile
+14
-1
lib/gitlab/danger/roulette.rb
lib/gitlab/danger/roulette.rb
+1
-6
spec/lib/gitlab/danger/roulette_spec.rb
spec/lib/gitlab/danger/roulette_spec.rb
+4
-4
No files found.
danger/roulette/Dangerfile
View file @
b1c6535f
...
...
@@ -39,6 +39,10 @@ MARKDOWN
OPTIONAL_REVIEW_TEMPLATE
=
"%{role} review is optional for %{category}"
.
freeze
NOT_AVAILABLE_TEMPLATE
=
'No %{role} available'
.
freeze
def
mr_author
roulette
.
team
.
find
{
|
person
|
person
.
username
==
gitlab
.
mr_author
}
end
def
note_for_category_role
(
spin
,
role
)
if
spin
.
optional_role
==
role
return
OPTIONAL_REVIEW_TEMPLATE
%
{
role:
role
.
capitalize
,
category:
helper
.
label_for_category
(
spin
.
category
)
}
...
...
@@ -68,7 +72,16 @@ if changes.any?
branch_name
=
gitlab
.
mr_json
[
'source_branch'
]
roulette_spins
=
roulette
.
spin
(
project
,
categories
,
branch_name
)
rows
=
roulette_spins
.
map
{
|
spin
|
markdown_row_for_spin
(
spin
)
}
rows
=
roulette_spins
.
map
do
|
spin
|
# MR includes QA changes, but also other changes, and author isn't an SET
if
spin
.
category
==
:qa
&&
categories
.
size
>
1
&&
!
mr_author
.
reviewer?
(
project
,
spin
.
category
,
[])
spin
.
optional_role
=
:maintainer
end
spin
.
optional_role
=
:maintainer
if
spin
.
category
==
:test
markdown_row_for_spin
(
spin
)
end
unknown
=
changes
.
fetch
(
:unknown
,
[])
...
...
lib/gitlab/danger/roulette.rb
View file @
b1c6535f
...
...
@@ -6,7 +6,6 @@ module Gitlab
module
Danger
module
Roulette
ROULETTE_DATA_URL
=
'https://gitlab-org.gitlab.io/gitlab-roulette/roulette.json'
OPTIONAL_CATEGORIES
=
[
:qa
,
:test
].
freeze
Spin
=
Struct
.
new
(
:category
,
:reviewer
,
:maintainer
,
:optional_role
)
...
...
@@ -119,11 +118,7 @@ module Gitlab
reviewer
=
spin_for_person
(
reviewers
+
traintainers
+
traintainers
,
random:
random
)
maintainer
=
spin_for_person
(
maintainers
,
random:
random
)
Spin
.
new
(
category
,
reviewer
,
maintainer
).
tap
do
|
spin
|
if
OPTIONAL_CATEGORIES
.
include?
(
category
)
spin
.
optional_role
=
:maintainer
end
end
Spin
.
new
(
category
,
reviewer
,
maintainer
)
end
end
end
...
...
spec/lib/gitlab/danger/roulette_spec.rb
View file @
b1c6535f
...
...
@@ -155,8 +155,8 @@ RSpec.describe Gitlab::Danger::Roulette do
context
'when change contains QA category'
do
let
(
:categories
)
{
[
:qa
]
}
it
'assigns QA reviewer
and sets optional QA maintainer
'
do
expect
(
spins
).
to
contain_exactly
(
matching_spin
(
:qa
,
reviewer:
software_engineer_in_test
,
optional: :maintainer
))
it
'assigns QA reviewer'
do
expect
(
spins
).
to
contain_exactly
(
matching_spin
(
:qa
,
reviewer:
software_engineer_in_test
))
end
end
...
...
@@ -171,8 +171,8 @@ RSpec.describe Gitlab::Danger::Roulette do
context
'when change contains test category'
do
let
(
:categories
)
{
[
:test
]
}
it
'assigns corresponding SET
and sets optional test maintainer
'
do
expect
(
spins
).
to
contain_exactly
(
matching_spin
(
:test
,
reviewer:
software_engineer_in_test
,
optional: :maintainer
))
it
'assigns corresponding SET'
do
expect
(
spins
).
to
contain_exactly
(
matching_spin
(
:test
,
reviewer:
software_engineer_in_test
))
end
end
end
...
...
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