Commit 7700e029 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '52560-fix-duplicate-tag-system-hooks' into 'master'

Only execute system hooks once when pushing tags

Closes #52560

See merge request gitlab-org/gitlab-ce!26888
parents 5a6908e3 d17cce6a
......@@ -13,7 +13,6 @@ module Git
EventCreateService.new.push(project, current_user, push_data)
Ci::CreatePipelineService.new(project, current_user, push_data).execute(:push, pipeline_options)
SystemHooksService.new.execute_hooks(build_system_push_data, :tag_push_hooks)
project.execute_hooks(push_data.dup, :tag_push_hooks)
project.execute_services(push_data.dup, :tag_push_hooks)
......@@ -50,17 +49,6 @@ module Git
push_options: params[:push_options] || [])
end
def build_system_push_data
Gitlab::DataBuilder::Push.build(
project,
current_user,
params[:oldrev],
params[:newrev],
params[:ref],
[],
'')
end
def pipeline_options
{} # to be overridden in EE
end
......
---
title: Only execute system hooks once when pushing tags
merge_request: 26888
author:
type: fixed
......@@ -31,6 +31,20 @@ describe Git::TagPushService do
end
end
describe 'System Hooks' do
let!(:push_data) { service.tap(&:execute).push_data }
it "executes system hooks after pushing a tag" do
expect_next_instance_of(SystemHooksService) do |system_hooks_service|
expect(system_hooks_service)
.to receive(:execute_hooks)
.with(push_data, :tag_push_hooks)
end
service.execute
end
end
describe "Pipelines" do
subject { service.execute }
......
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