2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
module Types
|
|
|
|
module Ci
|
|
|
|
class PipelineType < BaseObject
|
2019-05-30 16:15:17 +05:30
|
|
|
graphql_name 'Pipeline'
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
authorize :read_pipeline
|
|
|
|
|
|
|
|
expose_permissions Types::PermissionTypes::Ci::Pipeline
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
field :id, GraphQL::ID_TYPE, null: false,
|
|
|
|
description: 'ID of the pipeline'
|
|
|
|
field :iid, GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Internal ID of the pipeline'
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
field :sha, GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: "SHA of the pipeline's commit"
|
|
|
|
field :before_sha, GraphQL::STRING_TYPE, null: true,
|
|
|
|
description: 'Base SHA of the source branch'
|
|
|
|
field :status, PipelineStatusEnum, null: false,
|
|
|
|
description: "Status of the pipeline (#{::Ci::Pipeline.all_state_names.compact.join(', ').upcase})"
|
|
|
|
field :detailed_status, Types::Ci::DetailedStatusType, null: false,
|
|
|
|
description: 'Detailed status of the pipeline',
|
2019-07-07 11:18:12 +05:30
|
|
|
resolve: -> (obj, _args, ctx) { obj.detailed_status(ctx[:current_user]) }
|
2020-03-13 15:44:24 +05:30
|
|
|
field :duration, GraphQL::INT_TYPE, null: true,
|
|
|
|
description: 'Duration of the pipeline in seconds'
|
|
|
|
field :coverage, GraphQL::FLOAT_TYPE, null: true,
|
|
|
|
description: 'Coverage percentage'
|
|
|
|
field :created_at, Types::TimeType, null: false,
|
|
|
|
description: "Timestamp of the pipeline's creation"
|
|
|
|
field :updated_at, Types::TimeType, null: false,
|
|
|
|
description: "Timestamp of the pipeline's last activity"
|
|
|
|
field :started_at, Types::TimeType, null: true,
|
|
|
|
description: 'Timestamp when the pipeline was started'
|
|
|
|
field :finished_at, Types::TimeType, null: true,
|
|
|
|
description: "Timestamp of the pipeline's completion"
|
|
|
|
field :committed_at, Types::TimeType, null: true,
|
|
|
|
description: "Timestamp of the pipeline's commit"
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
# TODO: Add triggering user as a type
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|