diff options
Diffstat (limited to 'app/graphql/types/ci/job_type.rb')
-rw-r--r-- | app/graphql/types/ci/job_type.rb | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb index 60c1c2e601d..1d12c296b2e 100644 --- a/app/graphql/types/ci/job_type.rb +++ b/app/graphql/types/ci/job_type.rb @@ -25,8 +25,8 @@ module Types description: 'References to builds that must complete before the jobs run.' field :pipeline, Types::Ci::PipelineType, null: true, description: 'Pipeline the job belongs to.' - field :runner_machine, ::Types::Ci::RunnerMachineType, null: true, - description: 'Runner machine assigned to the job.', + field :runner_manager, ::Types::Ci::RunnerManagerType, null: true, + description: 'Runner manager assigned to the job.', alpha: { milestone: '15.11' } field :stage, Types::Ci::StageType, null: true, description: 'Stage of the job.' @@ -101,6 +101,8 @@ module Types description: 'Short SHA1 ID of the commit.' field :stuck, GraphQL::Types::Boolean, null: false, method: :stuck?, description: 'Indicates the job is stuck.' + field :trace, Types::Ci::JobTraceType, null: true, + description: 'Trace generated by the job.' field :triggered, GraphQL::Types::Boolean, null: true, description: 'Whether the job was triggered.' field :web_path, GraphQL::Types::String, null: true, @@ -144,6 +146,10 @@ module Types end end + def trace + object.trace if object.has_trace? + end + def previous_stage_jobs_or_needs if object.scheduling_type == 'stage' Gitlab::Graphql::Lazy.with_value(previous_stage_jobs) do |jobs| @@ -172,17 +178,16 @@ module Types ::Gitlab::Graphql::Loaders::BatchModelLoader.new(::Ci::Stage, object.stage_id).find end - def runner_machine - BatchLoader::GraphQL.for(object.id).batch(key: :runner_machines) do |build_ids, loader| - plucked_build_to_machine_ids = ::Ci::RunnerMachineBuild.for_build(build_ids).pluck_build_id_and_runner_machine_id - runner_machines = ::Ci::RunnerMachine.id_in(plucked_build_to_machine_ids.values.uniq) - Preloaders::RunnerMachinePolicyPreloader.new(runner_machines, current_user).execute - runner_machines_by_id = runner_machines.index_by(&:id) + def runner_manager + BatchLoader::GraphQL.for(object.id).batch(key: :runner_managers) do |build_ids, loader| + plucked_build_to_runner_manager_ids = + ::Ci::RunnerManagerBuild.for_build(build_ids).pluck_build_id_and_runner_manager_id + runner_managers = ::Ci::RunnerManager.id_in(plucked_build_to_runner_manager_ids.values.uniq) + Preloaders::RunnerManagerPolicyPreloader.new(runner_managers, current_user).execute + runner_managers_by_id = runner_managers.index_by(&:id) build_ids.each do |build_id| - runner_machine_id = plucked_build_to_machine_ids[build_id] - - loader.call(build_id, runner_machines_by_id[runner_machine_id]) + loader.call(build_id, runner_managers_by_id[plucked_build_to_runner_manager_ids[build_id]]) end end end |