Commit 108d3765 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Simplify implementation of build retry service

parent d4522de2
module Ci module Ci
class RetryBuildService < ::BaseService class RetryBuildService < ::BaseService
def execute(build) 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 MergeRequests::AddTodoWhenBuildFailsService
.new(build.project, current_user) .new(build.project, current_user)
.close(new_build) .close(new_build)
...@@ -13,12 +13,6 @@ module Ci ...@@ -13,12 +13,6 @@ module Ci
end end
end end
def retry(build)
self.reprocess(build).tap do |new_build|
new_build.enqueue!
end
end
def reprocess(build) def reprocess(build)
unless can?(current_user, :update_build, build) unless can?(current_user, :update_build, build)
raise Gitlab::Access::AccessDeniedError raise Gitlab::Access::AccessDeniedError
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment