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
1567e003
Commit
1567e003
authored
Jul 20, 2020
by
Vitali Tatarintev
Committed by
Heinrich Lee Yu
Jul 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change PagerDuty webhook URL to be scoped
Use non-legacy scoped URL format for PagerDuty webhook
parent
c639cb5b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
13 additions
and
8 deletions
+13
-8
app/controllers/projects/settings/operations_controller.rb
app/controllers/projects/settings/operations_controller.rb
+1
-1
app/helpers/operations_helper.rb
app/helpers/operations_helper.rb
+1
-1
changelogs/unreleased/230459-change-pagerduty-webhook-url.yml
...gelogs/unreleased/230459-change-pagerduty-webhook-url.yml
+5
-0
config/routes/project.rb
config/routes/project.rb
+2
-2
doc/user/incident_management/img/pagerduty_incidents_integration_13_2.png
...t_management/img/pagerduty_incidents_integration_13_2.png
+0
-0
spec/controllers/projects/settings/operations_controller_spec.rb
...ntrollers/projects/settings/operations_controller_spec.rb
+2
-2
spec/helpers/operations_helper_spec.rb
spec/helpers/operations_helper_spec.rb
+1
-1
spec/requests/projects/incident_management/pagerduty_incidents_spec.rb
.../projects/incident_management/pagerduty_incidents_spec.rb
+1
-1
No files found.
app/controllers/projects/settings/operations_controller.rb
View file @
1567e003
...
@@ -45,7 +45,7 @@ module Projects
...
@@ -45,7 +45,7 @@ module Projects
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
pagerduty_token
=
project
.
incident_management_setting
&
.
pagerduty_token
pagerduty_token
=
project
.
incident_management_setting
&
.
pagerduty_token
webhook_url
=
project_incidents_pagerduty_url
(
project
,
token:
pagerduty_token
)
webhook_url
=
project_incidents_
integrations_
pagerduty_url
(
project
,
token:
pagerduty_token
)
render
json:
{
pagerduty_webhook_url:
webhook_url
,
pagerduty_token:
pagerduty_token
}
render
json:
{
pagerduty_webhook_url:
webhook_url
,
pagerduty_token:
pagerduty_token
}
else
else
...
...
app/helpers/operations_helper.rb
View file @
1567e003
...
@@ -45,7 +45,7 @@ module OperationsHelper
...
@@ -45,7 +45,7 @@ module OperationsHelper
send_email:
setting
.
send_email
.
to_s
,
send_email:
setting
.
send_email
.
to_s
,
pagerduty_active:
setting
.
pagerduty_active
.
to_s
,
pagerduty_active:
setting
.
pagerduty_active
.
to_s
,
pagerduty_token:
setting
.
pagerduty_token
.
to_s
,
pagerduty_token:
setting
.
pagerduty_token
.
to_s
,
pagerduty_webhook_url:
project_incidents_pagerduty_url
(
@project
,
token:
setting
.
pagerduty_token
),
pagerduty_webhook_url:
project_incidents_
integrations_
pagerduty_url
(
@project
,
token:
setting
.
pagerduty_token
),
pagerduty_reset_key_path:
reset_pagerduty_token_project_settings_operations_path
(
@project
)
pagerduty_reset_key_path:
reset_pagerduty_token_project_settings_operations_path
(
@project
)
}
}
end
end
...
...
changelogs/unreleased/230459-change-pagerduty-webhook-url.yml
0 → 100644
View file @
1567e003
---
title
:
Change PagerDuty webhook URL
merge_request
:
37321
author
:
type
:
changed
config/routes/project.rb
View file @
1567e003
...
@@ -291,6 +291,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
...
@@ -291,6 +291,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get
'details'
,
on: :member
get
'details'
,
on: :member
end
end
post
'incidents/integrations/pagerduty'
,
to:
'incident_management/pager_duty_incidents#create'
namespace
:error_tracking
do
namespace
:error_tracking
do
resources
:projects
,
only: :index
resources
:projects
,
only: :index
end
end
...
@@ -407,8 +409,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
...
@@ -407,8 +409,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
post
'alerts/notify'
,
to:
'alerting/notifications#create'
post
'alerts/notify'
,
to:
'alerting/notifications#create'
post
'incidents/pagerduty'
,
to:
'incident_management/pager_duty_incidents#create'
draw
:legacy_builds
draw
:legacy_builds
resources
:hooks
,
only:
[
:index
,
:create
,
:edit
,
:update
,
:destroy
],
constraints:
{
id:
/\d+/
}
do
# rubocop: disable Cop/PutProjectRoutesUnderScope
resources
:hooks
,
only:
[
:index
,
:create
,
:edit
,
:update
,
:destroy
],
constraints:
{
id:
/\d+/
}
do
# rubocop: disable Cop/PutProjectRoutesUnderScope
...
...
doc/user/incident_management/img/pagerduty_incidents_integration_13_2.png
View replaced file @
c639cb5b
View file @
1567e003
33.9 KB
|
W:
|
H:
42.3 KB
|
W:
|
H:
2-up
Swipe
Onion skin
spec/controllers/projects/settings/operations_controller_spec.rb
View file @
1567e003
...
@@ -206,7 +206,7 @@ RSpec.describe Projects::Settings::OperationsController do
...
@@ -206,7 +206,7 @@ RSpec.describe Projects::Settings::OperationsController do
reset_pagerduty_token
reset_pagerduty_token
new_token
=
incident_management_setting
.
reload
.
pagerduty_token
new_token
=
incident_management_setting
.
reload
.
pagerduty_token
new_webhook_url
=
project_incidents_pagerduty_url
(
project
,
token:
new_token
)
new_webhook_url
=
project_incidents_
integrations_
pagerduty_url
(
project
,
token:
new_token
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'pagerduty_webhook_url'
]).
to
eq
(
new_webhook_url
)
expect
(
json_response
[
'pagerduty_webhook_url'
]).
to
eq
(
new_webhook_url
)
...
@@ -219,7 +219,7 @@ RSpec.describe Projects::Settings::OperationsController do
...
@@ -219,7 +219,7 @@ RSpec.describe Projects::Settings::OperationsController do
it
'does not reset a token'
do
it
'does not reset a token'
do
reset_pagerduty_token
reset_pagerduty_token
new_webhook_url
=
project_incidents_pagerduty_url
(
project
,
token:
nil
)
new_webhook_url
=
project_incidents_
integrations_
pagerduty_url
(
project
,
token:
nil
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'pagerduty_webhook_url'
]).
to
eq
(
new_webhook_url
)
expect
(
json_response
[
'pagerduty_webhook_url'
]).
to
eq
(
new_webhook_url
)
...
...
spec/helpers/operations_helper_spec.rb
View file @
1567e003
...
@@ -152,7 +152,7 @@ RSpec.describe OperationsHelper do
...
@@ -152,7 +152,7 @@ RSpec.describe OperationsHelper do
send_email:
'false'
,
send_email:
'false'
,
pagerduty_active:
'true'
,
pagerduty_active:
'true'
,
pagerduty_token:
operations_settings
.
pagerduty_token
,
pagerduty_token:
operations_settings
.
pagerduty_token
,
pagerduty_webhook_url:
project_incidents_pagerduty_url
(
project
,
token:
operations_settings
.
pagerduty_token
),
pagerduty_webhook_url:
project_incidents_
integrations_
pagerduty_url
(
project
,
token:
operations_settings
.
pagerduty_token
),
pagerduty_reset_key_path:
reset_pagerduty_token_project_settings_operations_path
(
project
)
pagerduty_reset_key_path:
reset_pagerduty_token_project_settings_operations_path
(
project
)
)
)
end
end
...
...
spec/requests/projects/incident_management/pagerduty_incidents_spec.rb
View file @
1567e003
...
@@ -12,7 +12,7 @@ RSpec.describe 'PagerDuty webhook' do
...
@@ -12,7 +12,7 @@ RSpec.describe 'PagerDuty webhook' do
def
make_request
def
make_request
headers
=
{
'Content-Type'
=>
'application/json'
}
headers
=
{
'Content-Type'
=>
'application/json'
}
post
project_incidents_pagerduty_url
(
project
,
token:
'VALID-TOKEN'
),
params:
payload
.
to_json
,
headers:
headers
post
project_incidents_
integrations_
pagerduty_url
(
project
,
token:
'VALID-TOKEN'
),
params:
payload
.
to_json
,
headers:
headers
end
end
before
do
before
do
...
...
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