Commit 2de64d3f authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'jivanvl-add-fields-to-job-type-graphql' into 'master'

Add id and short_sha fields to the graphql job_type

See merge request gitlab-org/gitlab!56714
parents c41fc727 0a320733
...@@ -6,6 +6,8 @@ module Types ...@@ -6,6 +6,8 @@ module Types
graphql_name 'CiJob' graphql_name 'CiJob'
authorize :read_commit_status authorize :read_commit_status
field :id, GraphQL::ID_TYPE, null: false,
description: 'ID of the job.'
field :pipeline, Types::Ci::PipelineType, null: true, field :pipeline, Types::Ci::PipelineType, null: true,
description: 'Pipeline the job belongs to.' description: 'Pipeline the job belongs to.'
field :name, GraphQL::STRING_TYPE, null: true, field :name, GraphQL::STRING_TYPE, null: true,
...@@ -22,6 +24,8 @@ module Types ...@@ -22,6 +24,8 @@ module Types
description: 'When a job has finished running.' description: 'When a job has finished running.'
field :duration, GraphQL::INT_TYPE, null: true, field :duration, GraphQL::INT_TYPE, null: true,
description: 'Duration of the job in seconds.' description: 'Duration of the job in seconds.'
field :short_sha, type: GraphQL::STRING_TYPE, null: false,
description: 'Short SHA1 ID of the commit.'
def pipeline def pipeline
Gitlab::Graphql::Loaders::BatchModelLoader.new(::Ci::Pipeline, object.pipeline_id).find Gitlab::Graphql::Loaders::BatchModelLoader.new(::Ci::Pipeline, object.pipeline_id).find
......
---
title: Add id and short_sha GraphQL fields to jobType in the CI namespace
merge_request: 56714
author:
type: changed
...@@ -1198,10 +1198,12 @@ An edge in a connection. ...@@ -1198,10 +1198,12 @@ An edge in a connection.
| `detailedStatus` | [`DetailedStatus`](#detailedstatus) | Detailed status of the job. | | `detailedStatus` | [`DetailedStatus`](#detailedstatus) | Detailed status of the job. |
| `duration` | [`Int`](#int) | Duration of the job in seconds. | | `duration` | [`Int`](#int) | Duration of the job in seconds. |
| `finishedAt` | [`Time`](#time) | When a job has finished running. | | `finishedAt` | [`Time`](#time) | When a job has finished running. |
| `id` | [`ID!`](#id) | ID of the job. |
| `name` | [`String`](#string) | Name of the job. | | `name` | [`String`](#string) | Name of the job. |
| `needs` | [`CiBuildNeedConnection`](#cibuildneedconnection) | References to builds that must complete before the jobs run. | | `needs` | [`CiBuildNeedConnection`](#cibuildneedconnection) | References to builds that must complete before the jobs run. |
| `pipeline` | [`Pipeline`](#pipeline) | Pipeline the job belongs to. | | `pipeline` | [`Pipeline`](#pipeline) | Pipeline the job belongs to. |
| `scheduledAt` | [`Time`](#time) | Schedule for the build. | | `scheduledAt` | [`Time`](#time) | Schedule for the build. |
| `shortSha` | [`String!`](#string) | Short SHA1 ID of the commit. |
### `CiJobArtifact` ### `CiJobArtifact`
......
...@@ -8,6 +8,8 @@ RSpec.describe Types::Ci::JobType do ...@@ -8,6 +8,8 @@ RSpec.describe Types::Ci::JobType do
it 'exposes the expected fields' do it 'exposes the expected fields' do
expected_fields = %i[ expected_fields = %i[
id
shortSha
pipeline pipeline
name name
needs needs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment