diff options
Diffstat (limited to 'lib/api/ci/jobs.rb')
-rw-r--r-- | lib/api/ci/jobs.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/api/ci/jobs.rb b/lib/api/ci/jobs.rb index d9d0da2e4d1..86897eb61ae 100644 --- a/lib/api/ci/jobs.rb +++ b/lib/api/ci/jobs.rb @@ -114,11 +114,14 @@ module API build = find_build!(params[:job_id]) authorize!(:update_build, build) - break forbidden!('Job is not retryable') unless build.retryable? - build = ::Ci::Build.retry(build, current_user) + response = ::Ci::RetryJobService.new(@project, current_user).execute(build) - present build, with: Entities::Ci::Job + if response.success? + present response[:job], with: Entities::Ci::Job + else + forbidden!('Job is not retryable') + end end desc 'Erase job (remove artifacts and the trace)' do @@ -194,7 +197,7 @@ module API pipeline = current_authenticated_job.pipeline project = current_authenticated_job.project - agent_authorizations = Clusters::AgentAuthorizationsFinder.new(project).execute + agent_authorizations = ::Clusters::AgentAuthorizationsFinder.new(project).execute project_groups = project.group&.self_and_ancestor_ids&.map { |id| { id: id } } || [] user_access_level = project.team.max_member_access(current_user.id) roles_in_project = Gitlab::Access.sym_options_with_owner |