Commit 46378bf2 authored by Sean Arnold's avatar Sean Arnold Committed by Shinya Maeda

Enable Slack Notifications for alerts

- Remove feature flag checks
parent e9a42f3c
......@@ -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)
......
......@@ -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
......
---
title: Enable Slack notifications for alerts
merge_request: 34038
author:
type: added
......@@ -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
......
......@@ -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.
......@@ -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
......
......@@ -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) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment