summaryrefslogtreecommitdiff
path: root/app/services/git_tag_push_service.rb
blob: 0d8e6e85e47f35953c1781fb27bedf664fea0b03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class GitTagPushService
  attr_accessor :project, :user, :push_data

  def execute(project, user, oldrev, newrev, ref)
    @project, @user = project, user
    
    @push_data = build_push_data(oldrev, newrev, ref)

    EventCreateService.new.push(project, user, @push_data)
    project.execute_hooks(@push_data.dup, :tag_push_hooks)
    project.execute_services(@push_data.dup, :tag_push_hooks)

    project.repository.expire_cache

    true
  end

  private

  def build_push_data(oldrev, newrev, ref)
    Gitlab::PushDataBuilder.build(project, user, oldrev, newrev, ref, [])
  end
end