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
46378bf2
Commit
46378bf2
authored
Jun 16, 2020
by
Sean Arnold
Committed by
Shinya Maeda
Jun 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable Slack Notifications for alerts
- Remove feature flag checks
parent
e9a42f3c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
27 deletions
+31
-27
app/models/alert_management/alert.rb
app/models/alert_management/alert.rb
+0
-1
app/models/project_services/slack_service.rb
app/models/project_services/slack_service.rb
+1
-1
changelogs/unreleased/220415-feature-flag-enable-alert-slack-notifications.yml
.../220415-feature-flag-enable-alert-slack-notifications.yml
+5
-0
doc/user/project/integrations/img/slack_configuration.png
doc/user/project/integrations/img/slack_configuration.png
+0
-0
doc/user/project/integrations/slack.md
doc/user/project/integrations/slack.md
+17
-1
doc/user/project/operations/alert_management.md
doc/user/project/operations/alert_management.md
+8
-0
spec/services/alert_management/process_prometheus_alert_service_spec.rb
...alert_management/process_prometheus_alert_service_spec.rb
+0
-12
spec/services/projects/alerting/notify_service_spec.rb
spec/services/projects/alerting/notify_service_spec.rb
+0
-12
No files found.
app/models/alert_management/alert.rb
View file @
46378bf2
...
...
@@ -156,7 +156,6 @@ module AlertManagement
end
def
execute_services
return
unless
Feature
.
enabled?
(
:alert_slack_event
,
project
)
return
unless
project
.
has_active_services?
(
:alert_hooks
)
project
.
execute_services
(
hook_data
,
:alert_hooks
)
...
...
app/models/project_services/slack_service.rb
View file @
46378bf2
...
...
@@ -25,7 +25,7 @@ class SlackService < ChatNotificationService
def
supported_events
additional
=
[]
additional
<<
'alert'
if
Feature
.
enabled?
(
:alert_slack_event
,
project
)
additional
<<
'alert'
super
+
additional
end
...
...
changelogs/unreleased/220415-feature-flag-enable-alert-slack-notifications.yml
0 → 100644
View file @
46378bf2
---
title
:
Enable Slack notifications for alerts
merge_request
:
34038
author
:
type
:
added
doc/user/project/integrations/img/slack_configuration.png
deleted
100644 → 0
View file @
e9a42f3c
40.5 KB
doc/user/project/integrations/slack.md
View file @
46378bf2
...
...
@@ -23,7 +23,23 @@ The Slack Notifications Service allows your GitLab project to send events (e.g.
Your Slack team will now start receiving GitLab event notifications as configured.
![
Slack configuration
](
img/slack_configuration.png
)
### Triggers available for Slack notifications
The following triggers are available for Slack notifications:
-
**Push**
: Triggered by a push to the repository.
-
**Issue**
: Triggered when an issue is created, updated, or closed.
-
**Confidential issue**
: Triggered when a confidential issue is created,
updated, or closed.
-
**Merge request**
: Triggered when a merge request is created, updated, or
merged.
-
**Note**
: Triggered when someone adds a comment.
-
**Confidential note**
: Triggered when someone adds a confidential note.
-
**Tag push**
: Triggered when a new tag is pushed to the repository.
-
**Pipeline**
: Triggered when a pipeline status changes.
-
**Wiki page**
: Triggered when a wiki page is created or updated.
-
**Deployment**
: Triggered when a deployment finishes.
-
**Alert**
: Triggered when a new, unique alert is recorded.
## Troubleshooting
...
...
doc/user/project/operations/alert_management.md
View file @
46378bf2
...
...
@@ -155,3 +155,11 @@ After completing their portion of investigating or fixing the alert, users can
unassign their account from the alert when their role is complete.
The
[
alerts status
](
#alert-management-statuses
)
can be updated to
reflect if the alert has been resolved.
### Slack Notifications
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216326) in GitLab 13.1.
You can be alerted via a Slack message when a new alert has been received.
See the
[
Slack Notifications Service docs
](
../integrations/slack.md
)
for information on how to set this up.
spec/services/alert_management/process_prometheus_alert_service_spec.rb
View file @
46378bf2
...
...
@@ -90,18 +90,6 @@ RSpec.describe AlertManagement::ProcessPrometheusAlertService do
expect
(
ProjectServiceWorker
).
to
have_received
(
:perform_async
).
with
(
slack_service
.
id
,
an_instance_of
(
Hash
))
end
context
'feature flag disabled'
do
before
do
stub_feature_flags
(
alert_slack_event:
false
)
end
it
'does not execute the alert service hooks'
do
subject
expect
(
ProjectServiceWorker
).
not_to
have_received
(
:perform_async
)
end
end
end
context
'when alert cannot be created'
do
...
...
spec/services/projects/alerting/notify_service_spec.rb
View file @
46378bf2
...
...
@@ -145,18 +145,6 @@ describe Projects::Alerting::NotifyService do
expect
(
ProjectServiceWorker
).
to
have_received
(
:perform_async
).
with
(
slack_service
.
id
,
an_instance_of
(
Hash
))
end
context
'feature flag disabled'
do
before
do
stub_feature_flags
(
alert_slack_event:
false
)
end
it
'does not executes the alert service hooks'
do
subject
expect
(
ProjectServiceWorker
).
not_to
have_received
(
:perform_async
)
end
end
context
'existing alert with same fingerprint'
do
let
(
:fingerprint_sha
)
{
Digest
::
SHA1
.
hexdigest
(
fingerprint
)
}
let!
(
:existing_alert
)
{
create
(
:alert_management_alert
,
project:
project
,
fingerprint:
fingerprint_sha
)
}
...
...
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