debian-mirror-gitlab/app/graphql/mutations/ci/job/play.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
926 B
Ruby
Raw Normal View History

2021-06-08 01:23:25 +05:30
# frozen_string_literal: true
module Mutations
module Ci
module Job
class Play < Base
graphql_name 'JobPlay'
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
2023-03-17 16:20:25 +05:30
argument :variables, [::Types::Ci::VariableInputType],
required: false,
default_value: [],
replace_null_with_default: true,
description: 'Variables to use when playing a manual job.'
2021-06-08 01:23:25 +05:30
authorize :update_build
2023-03-17 16:20:25 +05:30
def resolve(id:, variables:)
2021-06-08 01:23:25 +05:30
job = authorized_find!(id: id)
project = job.project
2023-03-17 16:20:25 +05:30
variables = variables.map(&:to_h)
::Ci::PlayBuildService.new(project, current_user).execute(job, variables)
2021-06-08 01:23:25 +05:30
{
job: job,
errors: errors_on_object(job)
}
end
end
end
end
end