2021-06-08 01:23:25 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Ci
|
|
|
|
module Job
|
|
|
|
class Retry < Base
|
|
|
|
graphql_name 'JobRetry'
|
|
|
|
|
|
|
|
field :job,
|
|
|
|
Types::Ci::JobType,
|
|
|
|
null: true,
|
2021-10-27 15:23:28 +05:30
|
|
|
description: 'Job after the mutation.'
|
2021-06-08 01:23:25 +05:30
|
|
|
|
|
|
|
authorize :update_build
|
|
|
|
|
|
|
|
def resolve(id:)
|
|
|
|
job = authorized_find!(id: id)
|
|
|
|
project = job.project
|
|
|
|
|
2022-06-21 17:19:12 +05:30
|
|
|
response = ::Ci::RetryJobService.new(project, current_user).execute(job)
|
|
|
|
|
|
|
|
if response.success?
|
|
|
|
{
|
|
|
|
job: response[:job],
|
|
|
|
errors: []
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
job: nil,
|
|
|
|
errors: [response.message]
|
|
|
|
}
|
|
|
|
end
|
2021-06-08 01:23:25 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|