2014-03-05 20:23:49 +00:00
|
|
|
class GitTagPushService
|
|
|
|
attr_accessor :project, :user, :push_data
|
2014-03-13 09:37:13 +00:00
|
|
|
|
2014-03-06 15:08:51 +00:00
|
|
|
def execute(project, user, oldrev, newrev, ref)
|
2014-03-05 20:23:49 +00:00
|
|
|
@project, @user = project, user
|
2014-03-06 15:08:51 +00:00
|
|
|
@push_data = create_push_data(oldrev, newrev, ref)
|
2014-03-13 09:37:13 +00:00
|
|
|
|
2015-02-13 10:57:56 +00:00
|
|
|
EventCreateService.new.push(project, user, @push_data)
|
2014-03-13 09:37:13 +00:00
|
|
|
project.repository.expire_cache
|
2014-03-05 20:23:49 +00:00
|
|
|
project.execute_hooks(@push_data.dup, :tag_push_hooks)
|
2015-02-20 13:49:36 +00:00
|
|
|
project.execute_services(@push_data.dup, :tag_push_hooks)
|
2015-01-11 06:18:14 +00:00
|
|
|
|
|
|
|
true
|
2014-03-05 20:23:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2014-03-06 15:08:51 +00:00
|
|
|
def create_push_data(oldrev, newrev, ref)
|
2015-02-28 16:41:01 +00:00
|
|
|
data = Gitlab::PushDataBuilder.build(project, user, oldrev, newrev, ref, [])
|
|
|
|
data[:object_kind] = "tag_push"
|
|
|
|
data
|
2014-03-05 20:23:49 +00:00
|
|
|
end
|
|
|
|
end
|