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
47a5633e
Commit
47a5633e
authored
Apr 12, 2019
by
Peter Leitzen
Committed by
Sean McGivern
Apr 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Open issues from alerts as `GitLab Alert Bot`"
parent
1838cc1d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
6 deletions
+21
-6
ee/app/models/ee/user.rb
ee/app/models/ee/user.rb
+11
-1
ee/app/services/incident_management/create_issue_service.rb
ee/app/services/incident_management/create_issue_service.rb
+1
-3
ee/changelogs/unreleased/10159-open-issues-from-alerts-as-gitlab-alert-bot.yml
...sed/10159-open-issues-from-alerts-as-gitlab-alert-bot.yml
+5
-0
ee/spec/models/user_spec.rb
ee/spec/models/user_spec.rb
+3
-1
ee/spec/services/incident_management/create_issue_service_spec.rb
...services/incident_management/create_issue_service_spec.rb
+1
-1
No files found.
ee/app/models/ee/user.rb
View file @
47a5633e
...
@@ -74,7 +74,8 @@ module EE
...
@@ -74,7 +74,8 @@ module EE
scope
:group_view_details
,
->
{
where
(
'group_view = ? OR group_view IS NULL'
,
group_view
[
:details
])
}
scope
:group_view_details
,
->
{
where
(
'group_view = ? OR group_view IS NULL'
,
group_view
[
:details
])
}
enum
bot_type:
{
enum
bot_type:
{
support_bot:
1
support_bot:
1
,
alert_bot:
2
}
}
end
end
...
@@ -90,6 +91,15 @@ module EE
...
@@ -90,6 +91,15 @@ module EE
end
end
end
end
def
alert_bot
email_pattern
=
"alert%s@
#{
Settings
.
gitlab
.
host
}
"
unique_internal
(
where
(
bot_type: :alert_bot
),
'alert-bot'
,
email_pattern
)
do
|
u
|
u
.
bio
=
'The GitLab alert bot'
u
.
name
=
'GitLab Alert Bot'
end
end
override
:internal
override
:internal
def
internal
def
internal
super
.
or
(
where
.
not
(
bot_type:
nil
))
super
.
or
(
where
.
not
(
bot_type:
nil
))
...
...
ee/app/services/incident_management/create_issue_service.rb
View file @
47a5633e
...
@@ -24,9 +24,7 @@ module IncidentManagement
...
@@ -24,9 +24,7 @@ module IncidentManagement
def
issue_author
def
issue_author
strong_memoize
(
:issue_author
)
do
strong_memoize
(
:issue_author
)
do
# This is a temporary solution before we've implemented User.alert_bot
User
.
alert_bot
# https://gitlab.com/gitlab-org/gitlab-ee/issues/10159
User
.
ghost
end
end
end
end
...
...
ee/changelogs/unreleased/10159-open-issues-from-alerts-as-gitlab-alert-bot.yml
0 → 100644
View file @
47a5633e
---
title
:
Let the GitLab Alert bot open incident issues
merge_request
:
10460
author
:
type
:
added
ee/spec/models/user_spec.rb
View file @
47a5633e
...
@@ -524,8 +524,9 @@ describe User do
...
@@ -524,8 +524,9 @@ describe User do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:ghost
)
{
described_class
.
ghost
}
let!
(
:ghost
)
{
described_class
.
ghost
}
let!
(
:support_bot
)
{
described_class
.
support_bot
}
let!
(
:support_bot
)
{
described_class
.
support_bot
}
let!
(
:alert_bot
)
{
described_class
.
alert_bot
}
let!
(
:non_internal
)
{
[
user
]
}
let!
(
:non_internal
)
{
[
user
]
}
let!
(
:internal
)
{
[
ghost
,
support_bot
]
}
let!
(
:internal
)
{
[
ghost
,
support_bot
,
alert_bot
]
}
it
'returns non internal users'
do
it
'returns non internal users'
do
expect
(
described_class
.
internal
).
to
eq
(
internal
)
expect
(
described_class
.
internal
).
to
eq
(
internal
)
...
@@ -543,6 +544,7 @@ describe User do
...
@@ -543,6 +544,7 @@ describe User do
expect
(
ghost
.
bot?
).
to
eq
(
false
)
expect
(
ghost
.
bot?
).
to
eq
(
false
)
expect
(
support_bot
.
bot?
).
to
eq
(
true
)
expect
(
support_bot
.
bot?
).
to
eq
(
true
)
expect
(
alert_bot
.
bot?
).
to
eq
(
true
)
end
end
end
end
end
end
...
...
ee/spec/services/incident_management/create_issue_service_spec.rb
View file @
47a5633e
...
@@ -28,7 +28,7 @@ describe IncidentManagement::CreateIssueService do
...
@@ -28,7 +28,7 @@ describe IncidentManagement::CreateIssueService do
expect
(
subject
).
to
include
(
status: :success
)
expect
(
subject
).
to
include
(
status: :success
)
issue
=
subject
[
:issue
]
issue
=
subject
[
:issue
]
expect
(
issue
.
author
).
to
eq
(
User
.
ghos
t
)
expect
(
issue
.
author
).
to
eq
(
User
.
alert_bo
t
)
expect
(
issue
.
title
).
to
eq
(
alert_title
)
expect
(
issue
.
title
).
to
eq
(
alert_title
)
expect
(
issue
.
description
).
to
include
(
'Summary'
)
expect
(
issue
.
description
).
to
include
(
'Summary'
)
expect
(
issue
.
description
).
to
include
(
alert_title
)
expect
(
issue
.
description
).
to
include
(
alert_title
)
...
...
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