Commit 50ef4c74 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '230459-change-pagerduty-webhook-url' into 'master'

Change PagerDuty webhook URL to be scoped URL

Closes #230459

See merge request gitlab-org/gitlab!37321
parents d9367af7 1567e003
......@@ -45,7 +45,7 @@ module Projects
if result[:status] == :success
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 }
else
......
......@@ -45,7 +45,7 @@ module OperationsHelper
send_email: setting.send_email.to_s,
pagerduty_active: setting.pagerduty_active.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)
}
end
......
---
title: Change PagerDuty webhook URL
merge_request: 37321
author:
type: changed
......@@ -291,6 +291,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get 'details', on: :member
end
post 'incidents/integrations/pagerduty', to: 'incident_management/pager_duty_incidents#create'
namespace :error_tracking do
resources :projects, only: :index
end
......@@ -407,8 +409,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
post 'alerts/notify', to: 'alerting/notifications#create'
post 'incidents/pagerduty', to: 'incident_management/pager_duty_incidents#create'
draw :legacy_builds
resources :hooks, only: [:index, :create, :edit, :update, :destroy], constraints: { id: /\d+/ } do # rubocop: disable Cop/PutProjectRoutesUnderScope
......
......@@ -206,7 +206,7 @@ RSpec.describe Projects::Settings::OperationsController do
reset_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(json_response['pagerduty_webhook_url']).to eq(new_webhook_url)
......@@ -219,7 +219,7 @@ RSpec.describe Projects::Settings::OperationsController do
it 'does not reset a token' do
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(json_response['pagerduty_webhook_url']).to eq(new_webhook_url)
......
......@@ -152,7 +152,7 @@ RSpec.describe OperationsHelper do
send_email: 'false',
pagerduty_active: 'true',
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)
)
end
......
......@@ -12,7 +12,7 @@ RSpec.describe 'PagerDuty webhook' do
def make_request
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
before do
......
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