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
d3250ebe
Commit
d3250ebe
authored
Nov 13, 2020
by
syasonik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove feature flag references
parent
2b4b4901
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
12 additions
and
102 deletions
+12
-102
app/controllers/projects/alerting/notifications_controller.rb
...controllers/projects/alerting/notifications_controller.rb
+0
-2
app/graphql/resolvers/alert_management/integrations_resolver.rb
...aphql/resolvers/alert_management/integrations_resolver.rb
+0
-2
app/services/alert_management/http_integrations/create_service.rb
...ices/alert_management/http_integrations/create_service.rb
+1
-1
app/services/alert_management/http_integrations/destroy_service.rb
...ces/alert_management/http_integrations/destroy_service.rb
+0
-5
app/services/alert_management/http_integrations/update_service.rb
...ices/alert_management/http_integrations/update_service.rb
+0
-5
app/services/projects/alerting/notify_service.rb
app/services/projects/alerting/notify_service.rb
+2
-11
changelogs/unreleased/sy-ff-removal-multiple-http-endpoints.yml
...logs/unreleased/sy-ff-removal-multiple-http-endpoints.yml
+5
-0
config/feature_flags/development/multiple_http_integrations.yml
.../feature_flags/development/multiple_http_integrations.yml
+0
-8
ee/spec/services/projects/alerting/notify_service_spec.rb
ee/spec/services/projects/alerting/notify_service_spec.rb
+3
-3
locale/gitlab.pot
locale/gitlab.pot
+0
-3
spec/controllers/projects/alerting/notifications_controller_spec.rb
...ollers/projects/alerting/notifications_controller_spec.rb
+0
-12
spec/graphql/resolvers/alert_management/integrations_resolver_spec.rb
.../resolvers/alert_management/integrations_resolver_spec.rb
+0
-8
spec/services/alert_management/http_integrations/create_service_spec.rb
...alert_management/http_integrations/create_service_spec.rb
+0
-8
spec/services/alert_management/http_integrations/destroy_service_spec.rb
...lert_management/http_integrations/destroy_service_spec.rb
+0
-8
spec/services/alert_management/http_integrations/update_service_spec.rb
...alert_management/http_integrations/update_service_spec.rb
+0
-8
spec/services/projects/alerting/notify_service_spec.rb
spec/services/projects/alerting/notify_service_spec.rb
+1
-18
No files found.
app/controllers/projects/alerting/notifications_controller.rb
View file @
d3250ebe
...
...
@@ -46,8 +46,6 @@ module Projects
end
def
integration
return
unless
Feature
.
enabled?
(
:multiple_http_integrations
,
project
)
AlertManagement
::
HttpIntegrationsFinder
.
new
(
project
,
endpoint_identifier:
endpoint_identifier
,
...
...
app/graphql/resolvers/alert_management/integrations_resolver.rb
View file @
d3250ebe
...
...
@@ -8,8 +8,6 @@ module Resolvers
type
Types
::
AlertManagement
::
IntegrationType
.
connection_type
,
null:
true
def
resolve
(
**
args
)
return
[]
unless
Feature
.
enabled?
(
:multiple_http_integrations
,
project
)
http_integrations
+
prometheus_integrations
end
...
...
app/services/alert_management/http_integrations/create_service.rb
View file @
d3250ebe
...
...
@@ -14,7 +14,7 @@ module AlertManagement
def
execute
return
error_no_permissions
unless
allowed?
return
error_multiple_integrations
unless
creation_allowed?
&&
Feature
.
enabled?
(
:multiple_http_integrations
,
project
)
return
error_multiple_integrations
unless
creation_allowed?
integration
=
project
.
alert_management_http_integrations
.
create
(
params
)
return
error_in_create
(
integration
)
unless
integration
.
valid?
...
...
app/services/alert_management/http_integrations/destroy_service.rb
View file @
d3250ebe
...
...
@@ -12,7 +12,6 @@ module AlertManagement
def
execute
return
error_no_permissions
unless
allowed?
return
error_multiple_integrations
unless
Feature
.
enabled?
(
:multiple_http_integrations
,
integration
.
project
)
if
integration
.
destroy
success
...
...
@@ -40,10 +39,6 @@ module AlertManagement
def
error_no_permissions
error
(
_
(
'You have insufficient permissions to remove this HTTP integration'
))
end
def
error_multiple_integrations
error
(
_
(
'Removing integrations is not supported for this project'
))
end
end
end
end
app/services/alert_management/http_integrations/update_service.rb
View file @
d3250ebe
...
...
@@ -14,7 +14,6 @@ module AlertManagement
def
execute
return
error_no_permissions
unless
allowed?
return
error_multiple_integrations
unless
Feature
.
enabled?
(
:multiple_http_integrations
,
integration
.
project
)
params
[
:token
]
=
nil
if
params
.
delete
(
:regenerate_token
)
...
...
@@ -44,10 +43,6 @@ module AlertManagement
def
error_no_permissions
error
(
_
(
'You have insufficient permissions to update this HTTP integration'
))
end
def
error_multiple_integrations
error
(
_
(
'Multiple HTTP integrations are not supported for this project'
))
end
end
end
end
app/services/projects/alerting/notify_service.rb
View file @
d3250ebe
...
...
@@ -25,7 +25,6 @@ module Projects
private
attr_reader
:integration
delegate
:alerts_service
,
:alerts_service_activated?
,
to: :project
def
process_alert
if
alert
.
persisted?
...
...
@@ -115,19 +114,11 @@ module Projects
end
def
active_integration?
if
Feature
.
enabled?
(
:multiple_http_integrations
,
project
)
return
true
if
integration
end
alerts_service_activated?
integration
&
.
active?
end
def
valid_token?
(
token
)
if
Feature
.
enabled?
(
:multiple_http_integrations
,
project
)
return
token
==
integration
.
token
if
integration
end
token
==
alerts_service
.
token
token
==
integration
.
token
end
def
bad_request
...
...
changelogs/unreleased/sy-ff-removal-multiple-http-endpoints.yml
0 → 100644
View file @
d3250ebe
---
title
:
Expose GraphQL API for managing HTTP alerting intergations
merge_request
:
47687
author
:
type
:
added
config/feature_flags/development/multiple_http_integrations.yml
deleted
100644 → 0
View file @
2b4b4901
---
name
:
multiple_http_integrations
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44485
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/255509
milestone
:
'
13.6'
type
:
development
group
:
group::health
default_enabled
:
false
ee/spec/services/projects/alerting/notify_service_spec.rb
View file @
d3250ebe
...
...
@@ -7,16 +7,16 @@ RSpec.describe Projects::Alerting::NotifyService do
describe
'#execute'
do
let
(
:service
)
{
described_class
.
new
(
project
,
nil
,
payload
)
}
let
(
:token
)
{
alerts_service
.
token
}
let
(
:token
)
{
integration
.
token
}
let
(
:payload
)
do
{
'title'
=>
'Test alert title'
}
end
let
(
:
alerts_service
)
{
create
(
:alerts_service
,
project:
project
)
}
let
(
:
integration
)
{
create
(
:alert_management_http_integration
,
project:
project
)
}
subject
{
service
.
execute
(
token
)
}
subject
{
service
.
execute
(
token
,
integration
)
}
context
'existing alert with same payload fingerprint'
do
let
(
:existing_alert
)
{
create
(
:alert_management_alert
,
:from_payload
,
project:
project
,
payload:
payload
)
}
...
...
locale/gitlab.pot
View file @
d3250ebe
...
...
@@ -22636,9 +22636,6 @@ msgstr ""
msgid "Removes time estimate."
msgstr ""
msgid "Removing integrations is not supported for this project"
msgstr ""
msgid "Removing this group also removes all child projects, including archived projects, and their resources."
msgstr ""
...
...
spec/controllers/projects/alerting/notifications_controller_spec.rb
View file @
d3250ebe
...
...
@@ -89,18 +89,6 @@ RSpec.describe Projects::Alerting::NotificationsController do
make_request
end
end
context
'when multiple endpoints are disabled'
do
before
do
stub_feature_flags
(
multiple_http_integrations:
false
)
end
it
'does not find an integration'
do
expect
(
notify_service
).
to
receive
(
:execute
).
with
(
'some token'
,
nil
)
make_request
end
end
end
context
'without integration parameters specified'
do
...
...
spec/graphql/resolvers/alert_management/integrations_resolver_spec.rb
View file @
d3250ebe
...
...
@@ -28,14 +28,6 @@ RSpec.describe Resolvers::AlertManagement::IntegrationsResolver do
end
it
{
is_expected
.
to
contain_exactly
(
active_http_integration
,
prometheus_integration
)
}
context
'feature flag is not enabled'
do
before
do
stub_feature_flags
(
multiple_http_integrations:
false
)
end
it
{
is_expected
.
to
be_empty
}
end
end
private
...
...
spec/services/alert_management/http_integrations/create_service_spec.rb
View file @
d3250ebe
...
...
@@ -38,14 +38,6 @@ RSpec.describe AlertManagement::HttpIntegrations::CreateService do
it_behaves_like
'error response'
,
'You have insufficient permissions to create an HTTP integration for this project'
end
context
'when feature flag is not enabled'
do
before
do
stub_feature_flags
(
multiple_http_integrations:
false
)
end
it_behaves_like
'error response'
,
'Multiple HTTP integrations are not supported for this project'
end
context
'when an integration already exists'
do
let_it_be
(
:existing_integration
)
{
create
(
:alert_management_http_integration
,
project:
project
)
}
...
...
spec/services/alert_management/http_integrations/destroy_service_spec.rb
View file @
d3250ebe
...
...
@@ -38,14 +38,6 @@ RSpec.describe AlertManagement::HttpIntegrations::DestroyService do
it_behaves_like
'error response'
,
'You have insufficient permissions to remove this HTTP integration'
end
context
'when feature flag is not enabled'
do
before
do
stub_feature_flags
(
multiple_http_integrations:
false
)
end
it_behaves_like
'error response'
,
'Removing integrations is not supported for this project'
end
context
'when an error occurs during removal'
do
before
do
allow
(
integration
).
to
receive
(
:destroy
).
and_return
(
false
)
...
...
spec/services/alert_management/http_integrations/update_service_spec.rb
View file @
d3250ebe
...
...
@@ -39,14 +39,6 @@ RSpec.describe AlertManagement::HttpIntegrations::UpdateService do
it_behaves_like
'error response'
,
'You have insufficient permissions to update this HTTP integration'
end
context
'when feature flag is not enabled'
do
before
do
stub_feature_flags
(
multiple_http_integrations:
false
)
end
it_behaves_like
'error response'
,
'Multiple HTTP integrations are not supported for this project'
end
context
'when an error occurs during update'
do
let
(
:params
)
{
{
name:
''
}
}
...
...
spec/services/projects/alerting/notify_service_spec.rb
View file @
d3250ebe
...
...
@@ -253,23 +253,6 @@ RSpec.describe Projects::Alerting::NotifyService do
end
end
context
'with an Alerts Service'
do
let_it_be_with_reload
(
:integration
)
{
create
(
:alerts_service
,
project:
project
)
}
it_behaves_like
'notifcations are handled correctly'
do
let
(
:source
)
{
'Generic Alert Endpoint'
}
end
context
'with deactivated Alerts Service'
do
before
do
integration
.
update!
(
active:
false
)
end
it_behaves_like
'does not process incident issues due to error'
,
http_status: :forbidden
it_behaves_like
'does not an create alert management alert'
end
end
context
'with an HTTP Integration'
do
let_it_be_with_reload
(
:integration
)
{
create
(
:alert_management_http_integration
,
project:
project
)
}
...
...
@@ -284,7 +267,7 @@ RSpec.describe Projects::Alerting::NotifyService do
integration
.
update!
(
active:
false
)
end
it_behaves_like
'does not process incident issues due to error'
,
http_status: :
unauthorized
it_behaves_like
'does not process incident issues due to error'
,
http_status: :
forbidden
it_behaves_like
'does not an create alert management alert'
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