From d2c1558f76f0b06dacd1c0393df5749e94177103 Mon Sep 17 00:00:00 2001 From: Luke Duncalfe Date: Mon, 28 Feb 2022 15:57:22 +1300 Subject: [PATCH] Remove support for recursion param passed in data This represents M+2 of the multi-step process to migrate passing the recursion param through the new `params` hash instead of `data. https://gitlab.com/gitlab-org/gitlab/-/issues/347389 --- app/workers/web_hook_worker.rb | 6 ------ spec/workers/web_hook_worker_spec.rb | 9 --------- 2 files changed, 15 deletions(-) diff --git a/app/workers/web_hook_worker.rb b/app/workers/web_hook_worker.rb index fdcd22128a35a4..301f3720991b36 100644 --- a/app/workers/web_hook_worker.rb +++ b/app/workers/web_hook_worker.rb @@ -13,9 +13,6 @@ class WebHookWorker worker_has_external_dependencies! - # Webhook recursion detection properties may be passed through the `data` arg. - # This will be migrated to the `params` arg over the next few releases. - # See https://gitlab.com/gitlab-org/gitlab/-/issues/347389. def perform(hook_id, data, hook_name, params = {}) hook = WebHook.find_by_id(hook_id) return unless hook @@ -23,9 +20,6 @@ def perform(hook_id, data, hook_name, params = {}) data = data.with_indifferent_access params.symbolize_keys! - # TODO: Remove in 14.9 https://gitlab.com/gitlab-org/gitlab/-/issues/347389 - params[:recursion_detection_request_uuid] ||= data.delete(:_gitlab_recursion_detection_request_uuid) - # Before executing the hook, reapply any recursion detection UUID that was initially # present in the request header so the hook can pass this same header value in its request. Gitlab::WebHooks::RecursionDetection.set_request_uuid(params[:recursion_detection_request_uuid]) diff --git a/spec/workers/web_hook_worker_spec.rb b/spec/workers/web_hook_worker_spec.rb index dbdf7a2b978d5d..e2ff36975c4056 100644 --- a/spec/workers/web_hook_worker_spec.rb +++ b/spec/workers/web_hook_worker_spec.rb @@ -28,15 +28,6 @@ .to change { Gitlab::WebHooks::RecursionDetection::UUID.instance.request_uuid }.to(uuid) end - it 'retrieves recursion detection data, reinstates it, and cleans it from payload when passed through as data', :request_store, :aggregate_failures do - uuid = SecureRandom.uuid - full_data = data.merge({ _gitlab_recursion_detection_request_uuid: uuid }) - - expect_next(WebHookService, project_hook, data.with_indifferent_access, hook_name, anything).to receive(:execute) - expect { subject.perform(project_hook.id, full_data, hook_name) } - .to change { Gitlab::WebHooks::RecursionDetection::UUID.instance.request_uuid }.to(uuid) - end - it_behaves_like 'worker with data consistency', described_class, data_consistency: :delayed -- GitLab