git_tag_push_service.rb 621 Bytes
Newer Older
1
2
class GitTagPushService
  attr_accessor :project, :user, :push_data
3

4
  def execute(project, user, oldrev, newrev, ref)
5
    @project, @user = project, user
6
    @push_data = create_push_data(oldrev, newrev, ref)
7

8
    EventCreateService.new.push(project, user, @push_data)
9
    project.repository.expire_cache
10
    project.execute_hooks(@push_data.dup, :tag_push_hooks)
11
12
13
14
15
16

    if project.gitlab_ci?
      project.gitlab_ci_service.async_execute(@push_data)
    end

    true
17
18
19
20
  end

  private

21
  def create_push_data(oldrev, newrev, ref)
22
23
    Gitlab::PushDataBuilder.
      build(project, user, oldrev, newrev, ref, [])
24
25
  end
end