2019-03-22 16:44:14 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Git
|
2019-03-28 14:59:24 +00:00
|
|
|
class TagPushService < ::BaseService
|
2019-10-03 15:07:07 +00:00
|
|
|
include ChangeParams
|
|
|
|
|
2019-03-22 16:44:14 +00:00
|
|
|
def execute
|
2019-10-03 15:07:07 +00:00
|
|
|
return unless Gitlab::Git.tag_ref?(ref)
|
2019-03-22 16:44:14 +00:00
|
|
|
|
2019-03-28 14:59:24 +00:00
|
|
|
project.repository.before_push_tag
|
|
|
|
TagHooksService.new(project, current_user, params).execute
|
2019-03-22 16:44:14 +00:00
|
|
|
|
2020-07-14 12:09:14 +00:00
|
|
|
unlock_artifacts
|
|
|
|
|
2019-03-22 16:44:14 +00:00
|
|
|
true
|
|
|
|
end
|
2020-07-14 12:09:14 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def unlock_artifacts
|
|
|
|
return unless removing_tag?
|
|
|
|
|
|
|
|
Ci::RefDeleteUnlockArtifactsWorker.perform_async(project.id, current_user.id, ref)
|
|
|
|
end
|
|
|
|
|
|
|
|
def removing_tag?
|
|
|
|
Gitlab::Git.blank_ref?(newrev)
|
|
|
|
end
|
2019-03-22 16:44:14 +00:00
|
|
|
end
|
|
|
|
end
|