debian-mirror-gitlab/app/graphql/types/ci/pipeline_type.rb

40 lines
1.7 KiB
Ruby
Raw Normal View History

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
2019-12-04 20:38:33 +05:30
field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions
field :iid, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
2018-11-08 19:23:39 +05:30
2019-12-04 20:38:33 +05:30
field :sha, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
field :before_sha, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions
field :status, PipelineStatusEnum, null: false # rubocop:disable Graphql/Descriptions
field :detailed_status, # rubocop:disable Graphql/Descriptions
2019-07-07 11:18:12 +05:30
Types::Ci::DetailedStatusType,
null: false,
resolve: -> (obj, _args, ctx) { obj.detailed_status(ctx[:current_user]) }
2018-11-08 19:23:39 +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"
2019-12-04 20:38:33 +05:30
field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions
field :updated_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions
field :started_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions
field :finished_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions
field :committed_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions
2018-11-08 19:23:39 +05:30
# TODO: Add triggering user as a type
end
end
end