1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# frozen_string_literal: true
module Types
module Ci
class JobType < BaseObject
graphql_name 'CiJob'
authorize :read_commit_status
field :pipeline, Types::Ci::PipelineType, null: true,
description: 'Pipeline the job belongs to.'
field :name, GraphQL::STRING_TYPE, null: true,
description: 'Name of the job.'
field :needs, BuildNeedType.connection_type, null: true,
description: 'References to builds that must complete before the jobs run.'
field :detailed_status, Types::Ci::DetailedStatusType, null: true,
description: 'Detailed status of the job.'
field :scheduled_at, Types::TimeType, null: true,
description: 'Schedule for the build.'
field :artifacts, Types::Ci::JobArtifactType.connection_type, null: true,
description: 'Artifacts generated by the job.'
field :finished_at, Types::TimeType, null: true,
description: 'When a job has finished running.'
field :duration, GraphQL::INT_TYPE, null: true,
description: 'Duration of the job in seconds.'
def pipeline
Gitlab::Graphql::Loaders::BatchModelLoader.new(::Ci::Pipeline, object.pipeline_id).find
end
def detailed_status
object.detailed_status(context[:current_user])
end
def artifacts
if object.is_a?(::Ci::Build)
object.job_artifacts
end
end
end
end
end
|