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
6bf4e937
Commit
6bf4e937
authored
Jan 04, 2021
by
syasonik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove logic for opsgenie integration
parent
194ed506
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1 addition
and
256 deletions
+1
-256
app/helpers/projects/alert_management_helper.rb
app/helpers/projects/alert_management_helper.rb
+0
-2
app/models/project_services/alerts_service.rb
app/models/project_services/alerts_service.rb
+0
-2
ee/app/controllers/concerns/ee/service_params.rb
ee/app/controllers/concerns/ee/service_params.rb
+0
-2
ee/app/helpers/ee/operations_helper.rb
ee/app/helpers/ee/operations_helper.rb
+1
-12
ee/app/helpers/ee/projects/alert_management_helper.rb
ee/app/helpers/ee/projects/alert_management_helper.rb
+0
-28
ee/app/models/ee/alerts_service.rb
ee/app/models/ee/alerts_service.rb
+0
-21
ee/app/models/license.rb
ee/app/models/license.rb
+0
-1
ee/spec/helpers/ee/operations_helper_spec.rb
ee/spec/helpers/ee/operations_helper_spec.rb
+0
-41
ee/spec/helpers/ee/projects/alert_management_helper_spec.rb
ee/spec/helpers/ee/projects/alert_management_helper_spec.rb
+0
-53
ee/spec/models/project_services/alerts_service_spec.rb
ee/spec/models/project_services/alerts_service_spec.rb
+0
-94
No files found.
app/helpers/projects/alert_management_helper.rb
View file @
6bf4e937
...
...
@@ -34,5 +34,3 @@ module Projects::AlertManagementHelper
)
end
end
Projects
::
AlertManagementHelper
.
prepend_if_ee
(
'EE::Projects::AlertManagementHelper'
)
app/models/project_services/alerts_service.rb
View file @
6bf4e937
...
...
@@ -88,5 +88,3 @@ class AlertsService < Service
.
execute
end
end
AlertsService
.
prepend_if_ee
(
'EE::AlertsService'
)
ee/app/controllers/concerns/ee/service_params.rb
View file @
6bf4e937
...
...
@@ -10,8 +10,6 @@ module EE
:multiproject_enabled
,
:pass_unstable
,
:project_name
,
:opsgenie_mvc_enabled
,
:opsgenie_mvc_target_url
,
:repository_url
,
:static_context
,
:vulnerabilities_enabled
,
...
...
ee/app/helpers/ee/operations_helper.rb
View file @
6bf4e937
...
...
@@ -37,7 +37,7 @@ module EE
override
:alerts_settings_data
def
alerts_settings_data
(
disabled:
false
)
super
.
merge
(
opsgenie_mvc_data
,
alert_management_multiple_integrations_data
)
super
.
merge
(
alert_management_multiple_integrations_data
)
end
override
:operations_settings_data
...
...
@@ -67,17 +67,6 @@ module EE
::
IncidentManagement
::
IncidentSla
.
available_for?
(
@project
)
end
def
opsgenie_mvc_data
return
{}
unless
alerts_service
.
opsgenie_mvc_available?
{
'opsgenie_mvc_available'
=>
'true'
,
'opsgenie_mvc_form_path'
=>
scoped_integration_path
(
alerts_service
),
'opsgenie_mvc_enabled'
=>
alerts_service
.
opsgenie_mvc_enabled?
.
to_s
,
'opsgenie_mvc_target_url'
=>
alerts_service
.
opsgenie_mvc_target_url
.
to_s
}
end
def
alert_management_multiple_integrations_data
{
'multi_integrations'
=>
@project
.
feature_available?
(
:multiple_alert_http_integrations
).
to_s
...
...
ee/app/helpers/ee/projects/alert_management_helper.rb
deleted
100644 → 0
View file @
194ed506
# frozen_string_literal: true
module
EE
module
Projects
module
AlertManagementHelper
extend
::
Gitlab
::
Utils
::
Override
override
:alert_management_data
def
alert_management_data
(
current_user
,
project
)
super
.
merge
(
alert_management_opsgenie_mvc_data
(
project
.
alerts_service
)
)
end
private
def
alert_management_opsgenie_mvc_data
(
alerts_service
)
return
{}
unless
alerts_service
&
.
opsgenie_mvc_available?
{
'opsgenie_mvc_available'
=>
'true'
,
'opsgenie_mvc_enabled'
=>
alerts_service
.
opsgenie_mvc_enabled?
.
to_s
,
'opsgenie_mvc_target_url'
=>
alerts_service
.
opsgenie_mvc_target_url
.
to_s
}
end
end
end
end
ee/app/models/ee/alerts_service.rb
deleted
100644 → 0
View file @
194ed506
# frozen_string_literal: true
module
EE
module
AlertsService
extend
ActiveSupport
::
Concern
prepended
do
boolean_accessor
:opsgenie_mvc_enabled
prop_accessor
:opsgenie_mvc_target_url
validates
:opsgenie_mvc_target_url
,
presence:
true
,
public_url:
true
,
if: :opsgenie_mvc_enabled?
end
def
opsgenie_mvc_available?
return
false
if
instance?
||
template?
project
.
feature_available?
(
:opsgenie_integration
)
end
end
end
ee/app/models/license.rb
View file @
6bf4e937
...
...
@@ -111,7 +111,6 @@ class License < ApplicationRecord
multiple_group_issue_boards
object_storage
operations_dashboard
opsgenie_integration
package_forwarding
pages_size_limit
productivity_analytics
...
...
ee/spec/helpers/ee/operations_helper_spec.rb
View file @
6bf4e937
...
...
@@ -75,47 +75,6 @@ RSpec.describe OperationsHelper, :routing do
describe
'#alerts_settings_data'
do
subject
{
helper
.
alerts_settings_data
}
describe
'Opsgenie MVC attributes'
do
let_it_be
(
:alerts_service
)
do
create
(
:alerts_service
,
project:
project
,
opsgenie_mvc_enabled:
false
,
opsgenie_mvc_target_url:
'https://appname.app.opsgenie.com/alert/list'
)
end
let_it_be
(
:prometheus_service
)
{
build_stubbed
(
:prometheus_service
)
}
before
do
allow
(
helper
).
to
receive
(
:alerts_service
).
and_return
(
alerts_service
)
allow
(
helper
).
to
receive
(
:prometheus_service
).
and_return
(
prometheus_service
)
allow
(
alerts_service
).
to
receive
(
:opsgenie_mvc_available?
).
and_return
(
opsgenie_available
)
end
context
'when available'
do
let
(
:opsgenie_available
)
{
true
}
it
do
is_expected
.
to
include
(
'opsgenie_mvc_available'
=>
'true'
,
'opsgenie_mvc_form_path'
=>
project_service_path
(
project
,
alerts_service
),
'opsgenie_mvc_enabled'
=>
'false'
,
'opsgenie_mvc_target_url'
=>
'https://appname.app.opsgenie.com/alert/list'
)
end
end
context
'when not available'
do
let
(
:opsgenie_keys
)
do
%w[opsgenie_mvc_available opsgenie_mvc_enabled opsgenie_mvc_form_path opsgenie_mvc_target_url]
end
let
(
:opsgenie_available
)
{
false
}
it
{
is_expected
.
not_to
include
(
opsgenie_keys
)
}
end
end
describe
'Multiple Integrations Support'
do
before
do
stub_licensed_features
(
multiple_alert_http_integrations:
multi_integrations
)
...
...
ee/spec/helpers/ee/projects/alert_management_helper_spec.rb
deleted
100644 → 0
View file @
194ed506
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Projects
::
AlertManagementHelper
do
let
(
:project
)
{
build_stubbed
(
:project
)
}
let
(
:current_user
)
{
build_stubbed
(
:user
)
}
before
do
allow
(
helper
).
to
receive
(
:can?
)
.
with
(
current_user
,
:admin_operations
,
project
)
{
true
}
end
describe
'#alert_management_data'
do
let
(
:alerts_service
)
do
build_stubbed
(
:alerts_service
,
project:
project
,
opsgenie_mvc_enabled:
false
,
opsgenie_mvc_target_url:
'https://appname.app.opsgenie.com/alert/list'
)
end
subject
{
helper
.
alert_management_data
(
current_user
,
project
)
}
before
do
allow
(
project
).
to
receive
(
:alerts_service
).
and_return
(
alerts_service
)
allow
(
alerts_service
).
to
receive
(
:opsgenie_mvc_available?
)
.
and_return
(
opsgenie_available
)
end
context
'when available'
do
let
(
:opsgenie_available
)
{
true
}
it
do
is_expected
.
to
include
(
'opsgenie_mvc_available'
=>
'true'
,
'opsgenie_mvc_enabled'
=>
'false'
,
'opsgenie_mvc_target_url'
=>
'https://appname.app.opsgenie.com/alert/list'
)
end
end
context
'when not available'
do
let
(
:opsgenie_keys
)
do
%w[opsgenie_mvc_available opsgenie_mvc_enabled opsgenie_mvc_target_url]
end
let
(
:opsgenie_available
)
{
false
}
it
{
is_expected
.
not_to
include
(
opsgenie_keys
)
}
end
end
end
ee/spec/models/project_services/alerts_service_spec.rb
deleted
100644 → 0
View file @
194ed506
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
AlertsService
do
let
(
:service
)
{
build_stubbed
(
:alerts_service
)
}
describe
'Opsgenie MVC'
do
describe
'#opsgenie_mvc_target_url'
do
context
'when enabled'
do
before
do
service
.
opsgenie_mvc_enabled
=
true
end
it
'validates presence'
do
expect
(
service
).
to
validate_presence_of
(
:opsgenie_mvc_target_url
)
end
describe
'enforces public urls'
do
where
(
:url
,
:valid
)
do
[
[
'https://appname.app.opsgenie.com/alert/list'
,
true
],
[
'https://example.com'
,
true
],
[
'http://example.com'
,
true
],
[
'http://0.0.0.0'
,
false
],
[
'http://127.0.0.1'
,
false
],
[
'ftp://example.com'
,
false
],
[
'invalid url'
,
false
]
]
end
with_them
do
before
do
service
.
opsgenie_mvc_target_url
=
url
end
if
params
[
:valid
]
it
{
expect
(
service
).
to
be_valid
}
else
it
{
expect
(
service
).
to
be_invalid
}
end
end
end
end
context
'when disabled'
do
before
do
service
.
opsgenie_mvc_enabled
=
false
end
it
'does not validate presence'
do
expect
(
service
).
not_to
validate_presence_of
(
:opsgenie_mvc_target_url
)
end
it
'allows any value'
do
service
.
opsgenie_mvc_target_url
=
'any value'
expect
(
service
).
to
be_valid
end
end
end
describe
'#opsgenie_mvc_available?'
do
subject
{
service
.
opsgenie_mvc_available?
}
before
do
stub_licensed_features
(
opsgenie_integration:
true
)
end
context
'when license is available'
do
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when license is not available'
do
before
do
stub_licensed_features
(
opsgenie_integration:
false
)
end
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when template service'
do
let
(
:service
)
{
build_stubbed
(
:alerts_service
,
:template
)
}
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when instance service'
do
let
(
:service
)
{
build_stubbed
(
:alerts_service
,
:instance
)
}
it
{
is_expected
.
to
eq
(
false
)
}
end
end
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