Simplify implementation of build retry service

This commit is contained in:
Grzegorz Bizon 2017-02-14 13:39:14 +01:00
parent d4522de2fd
commit 108d3765ab

View file

@ -1,9 +1,9 @@
module Ci
class RetryBuildService < ::BaseService
def execute(build)
# return unless build.retryable?
reprocess(build).tap do |new_build|
new_build.enqueue!
self.retry(build).tap do |new_build|
MergeRequests::AddTodoWhenBuildFailsService
.new(build.project, current_user)
.close(new_build)
@ -13,12 +13,6 @@ module Ci
end
end
def retry(build)
self.reprocess(build).tap do |new_build|
new_build.enqueue!
end
end
def reprocess(build)
unless can?(current_user, :update_build, build)
raise Gitlab::Access::AccessDeniedError