Commit f3d9e19b authored by Sean McGivern's avatar Sean McGivern

Merge branch 'sh-conditional-system-hook-push' into 'master'

Eliminate unnecessary and duplicate system hook fires

Closes #50549

See merge request gitlab-org/gitlab-ce!21337
parents 726f5cdc 377e3670
...@@ -140,7 +140,6 @@ class GitPushService < BaseService ...@@ -140,7 +140,6 @@ class GitPushService < BaseService
EventCreateService.new.push(project, current_user, build_push_data) EventCreateService.new.push(project, current_user, build_push_data)
Ci::CreatePipelineService.new(project, current_user, build_push_data).execute(:push) Ci::CreatePipelineService.new(project, current_user, build_push_data).execute(:push)
SystemHookPushWorker.perform_async(build_push_data.dup, :push_hooks)
project.execute_hooks(build_push_data.dup, :push_hooks) project.execute_hooks(build_push_data.dup, :push_hooks)
project.execute_services(build_push_data.dup, :push_hooks) project.execute_services(build_push_data.dup, :push_hooks)
......
---
title: Eliminate unnecessary and duplicate system hook fires
merge_request: 21337
author:
type: performance
...@@ -223,9 +223,13 @@ describe GitPushService, services: true do ...@@ -223,9 +223,13 @@ describe GitPushService, services: true do
end end
end end
context "Sends System Push data" do describe 'system hooks' do
it "when pushing on a branch" do let(:system_hook_service) { double() }
expect(SystemHookPushWorker).to receive(:perform_async).with(push_data, :push_hooks)
it "sends a system hook after pushing a branch" do
expect(SystemHooksService).to receive(:new).and_return(system_hook_service)
expect(system_hook_service).to receive(:execute_hooks).with(push_data, :push_hooks)
execute_service(project, user, oldrev, newrev, ref) execute_service(project, user, oldrev, newrev, ref)
end end
end end
......
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