Commit 32fe4a6e authored by Vitali Tatarintev's avatar Vitali Tatarintev

Deprecate ProcessAlertWorker params

Deprecate `ProcessAlertWorker` params (`project_id` and `alert_payload`)
instead of removing them.

Remove starting from 14.0 release.
https://gitlab.com/gitlab-org/gitlab/-/issues/224500
parent 2595a954
......@@ -65,7 +65,7 @@ module Projects
def process_incident_issues(alert)
return if alert.issue
IncidentManagement::ProcessAlertWorker.perform_async(alert.id)
IncidentManagement::ProcessAlertWorker.perform_async(nil, nil, alert.id)
end
def send_alert_email
......
......@@ -7,7 +7,12 @@ module IncidentManagement
queue_namespace :incident_management
feature_category :incident_management
def perform(alert_id)
# `project_id` and `alert_payload` are deprecated and can be removed
# starting from 14.0 release
# https://gitlab.com/gitlab-org/gitlab/-/issues/224500
def perform(_project_id = nil, _alert_payload = nil, alert_id = nil)
return unless alert_id
alert = find_alert(alert_id)
return unless alert
......@@ -24,7 +29,7 @@ module IncidentManagement
end
def parsed_payload(alert)
Gitlab::Alerting::NotificationPayloadParser.call(alert.payload.to_h)
Gitlab::Alerting::NotificationPayloadParser.call(alert.payload.to_h, alert.project)
end
def create_issue_for(alert)
......
......@@ -21,7 +21,7 @@ RSpec.describe Projects::Alerting::NotifyService do
it 'processes issues' do
expect(IncidentManagement::ProcessAlertWorker)
.to receive(:perform_async)
.with(kind_of(Integer))
.with(nil, nil, kind_of(Integer))
.once
Sidekiq::Testing.inline! do
......
......@@ -9,11 +9,11 @@ RSpec.describe IncidentManagement::ProcessAlertWorker do
describe '#perform' do
let_it_be(:started_at) { Time.now.rfc3339 }
let_it_be(:payload) { { 'title' => 'title', 'start_time' => started_at } }
let_it_be(:parsed_payload) { Gitlab::Alerting::NotificationPayloadParser.call(payload) }
let_it_be(:parsed_payload) { Gitlab::Alerting::NotificationPayloadParser.call(payload, project) }
let_it_be(:alert) { create(:alert_management_alert, project: project, payload: payload, started_at: started_at) }
let(:created_issue) { Issue.last! }
subject { described_class.new.perform(alert.id) }
subject { described_class.new.perform(nil, nil, alert.id) }
before do
allow(IncidentManagement::CreateIssueService)
......@@ -31,7 +31,7 @@ RSpec.describe IncidentManagement::ProcessAlertWorker do
context 'with invalid alert' do
let(:invalid_alert_id) { non_existing_record_id }
subject { described_class.new.perform(invalid_alert_id) }
subject { described_class.new.perform(nil, nil, invalid_alert_id) }
it 'does not create issues' do
expect(IncidentManagement::CreateIssueService).not_to receive(:new)
......
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