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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
f14228f0
Commit
f14228f0
authored
Dec 13, 2016
by
twonegatives
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Notify the user who set auto-merge when a build fails
parent
b1120fc3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
7 deletions
+21
-7
app/helpers/todos_helper.rb
app/helpers/todos_helper.rb
+1
-1
app/services/todo_service.rb
app/services/todo_service.rb
+9
-6
changelogs/unreleased/23524-notify-automerge-user-of-failed-build.yml
...nreleased/23524-notify-automerge-user-of-failed-build.yml
+4
-0
spec/services/todo_service_spec.rb
spec/services/todo_service_spec.rb
+7
-0
No files found.
app/helpers/todos_helper.rb
View file @
f14228f0
...
...
@@ -11,7 +11,7 @@ module TodosHelper
case
todo
.
action
when
Todo
::
ASSIGNED
then
'assigned you'
when
Todo
::
MENTIONED
then
'mentioned you on'
when
Todo
::
BUILD_FAILED
then
'The build failed for
your
'
when
Todo
::
BUILD_FAILED
then
'The build failed for'
when
Todo
::
MARKED
then
'added a todo for'
when
Todo
::
APPROVAL_REQUIRED
then
'set you as an approver for'
end
...
...
app/services/todo_service.rb
View file @
f14228f0
...
...
@@ -98,10 +98,12 @@ class TodoService
# When a build fails on the HEAD of a merge request we should:
#
# * create a todo for that user to fix it
# * create a todo for author of MR to fix it
# * create a todo for merge_user to keep an eye on it
#
def
merge_request_build_failed
(
merge_request
)
create_build_failed_todo
(
merge_request
)
create_build_failed_todo
(
merge_request
,
merge_request
.
author
)
create_build_failed_todo
(
merge_request
,
merge_request
.
merge_user
)
if
merge_request
.
merge_when_build_succeeds?
end
# When a new commit is pushed to a merge request we should:
...
...
@@ -115,9 +117,11 @@ class TodoService
# When a build is retried to a merge request we should:
#
# * mark all pending todos related to the merge request for the author as done
# * mark all pending todos related to the merge request for the merge_user as done
#
def
merge_request_build_retried
(
merge_request
)
mark_pending_todos_as_done
(
merge_request
,
merge_request
.
author
)
mark_pending_todos_as_done
(
merge_request
,
merge_request
.
merge_user
)
if
merge_request
.
merge_when_build_succeeds?
end
# When create a note we should:
...
...
@@ -236,10 +240,9 @@ class TodoService
create_todos
(
mentioned_users
,
attributes
)
end
def
create_build_failed_todo
(
merge_request
)
author
=
merge_request
.
author
attributes
=
attributes_for_todo
(
merge_request
.
project
,
merge_request
,
author
,
Todo
::
BUILD_FAILED
)
create_todos
(
author
,
attributes
)
def
create_build_failed_todo
(
merge_request
,
todo_author
)
attributes
=
attributes_for_todo
(
merge_request
.
project
,
merge_request
,
todo_author
,
Todo
::
BUILD_FAILED
)
create_todos
(
todo_author
,
attributes
)
end
def
attributes_for_target
(
target
)
...
...
changelogs/unreleased/23524-notify-automerge-user-of-failed-build.yml
0 → 100644
View file @
f14228f0
---
title
:
Create a TODO for user who set auto-merge when a build fails
merge_request
:
author
:
spec/services/todo_service_spec.rb
View file @
f14228f0
...
...
@@ -469,6 +469,13 @@ describe TodoService, services: true do
should_create_todo
(
user:
author
,
target:
mr_unassigned
,
action:
Todo
::
BUILD_FAILED
)
end
it
'creates a pending todo for merge_user'
do
mr_unassigned
.
update
(
merge_when_build_succeeds:
true
,
merge_user:
admin
)
service
.
merge_request_build_failed
(
mr_unassigned
)
should_create_todo
(
user:
admin
,
author:
admin
,
target:
mr_unassigned
,
action:
Todo
::
BUILD_FAILED
)
end
end
describe
'#merge_request_push'
do
...
...
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