Commit a1441526 authored by Frédéric Caplette's avatar Frédéric Caplette

Merge branch 'add-complete-field-to-pipeline-and-job' into 'master'

Add complete field to indicate if a pipeline/job is completed

See merge request gitlab-org/gitlab!61209
parents fa5a9902 8ef75e4f
...@@ -27,6 +27,7 @@ query getPipelineDetails($projectPath: ID!, $iid: ID!) { ...@@ -27,6 +27,7 @@ query getPipelineDetails($projectPath: ID!, $iid: ID!) {
__typename __typename
id id
iid iid
complete
usesNeeds usesNeeds
downstream { downstream {
__typename __typename
......
...@@ -24,6 +24,9 @@ module Types ...@@ -24,6 +24,9 @@ module Types
field :before_sha, GraphQL::STRING_TYPE, null: true, field :before_sha, GraphQL::STRING_TYPE, null: true,
description: 'Base SHA of the source branch.' description: 'Base SHA of the source branch.'
field :complete, GraphQL::BOOLEAN_TYPE, null: false, method: :complete?,
description: 'Indicates if a pipeline is complete.'
field :status, PipelineStatusEnum, null: false, field :status, PipelineStatusEnum, null: false,
description: "Status of the pipeline (#{::Ci::Pipeline.all_state_names.compact.join(', ').upcase})" description: "Status of the pipeline (#{::Ci::Pipeline.all_state_names.compact.join(', ').upcase})"
......
...@@ -7,6 +7,7 @@ class JobEntity < Grape::Entity ...@@ -7,6 +7,7 @@ class JobEntity < Grape::Entity
expose :name expose :name
expose :started?, as: :started expose :started?, as: :started
expose :complete?, as: :complete
expose :archived?, as: :archived expose :archived?, as: :archived
# bridge jobs don't have build detail pages # bridge jobs don't have build detail pages
......
---
title: Add complete field to indicate if a pipeline/job is complete
merge_request: 61209
author: Cong Chen @gentcys
type: added
...@@ -10625,6 +10625,7 @@ Information about pagination in a connection. ...@@ -10625,6 +10625,7 @@ Information about pagination in a connection.
| <a id="pipelinecodequalityreports"></a>`codeQualityReports` | [`CodeQualityDegradationConnection`](#codequalitydegradationconnection) | Code Quality degradations reported on the pipeline. (see [Connections](#connections)) | | <a id="pipelinecodequalityreports"></a>`codeQualityReports` | [`CodeQualityDegradationConnection`](#codequalitydegradationconnection) | Code Quality degradations reported on the pipeline. (see [Connections](#connections)) |
| <a id="pipelinecommitpath"></a>`commitPath` | [`String`](#string) | Path to the commit that triggered the pipeline. | | <a id="pipelinecommitpath"></a>`commitPath` | [`String`](#string) | Path to the commit that triggered the pipeline. |
| <a id="pipelinecommittedat"></a>`committedAt` | [`Time`](#time) | Timestamp of the pipeline's commit. | | <a id="pipelinecommittedat"></a>`committedAt` | [`Time`](#time) | Timestamp of the pipeline's commit. |
| <a id="pipelinecomplete"></a>`complete` | [`Boolean!`](#boolean) | Indicates if a pipeline is complete. |
| <a id="pipelineconfigsource"></a>`configSource` | [`PipelineConfigSourceEnum`](#pipelineconfigsourceenum) | Configuration source of the pipeline (UNKNOWN_SOURCE, REPOSITORY_SOURCE, AUTO_DEVOPS_SOURCE, WEBIDE_SOURCE, REMOTE_SOURCE, EXTERNAL_PROJECT_SOURCE, BRIDGE_SOURCE, PARAMETER_SOURCE, COMPLIANCE_SOURCE). | | <a id="pipelineconfigsource"></a>`configSource` | [`PipelineConfigSourceEnum`](#pipelineconfigsourceenum) | Configuration source of the pipeline (UNKNOWN_SOURCE, REPOSITORY_SOURCE, AUTO_DEVOPS_SOURCE, WEBIDE_SOURCE, REMOTE_SOURCE, EXTERNAL_PROJECT_SOURCE, BRIDGE_SOURCE, PARAMETER_SOURCE, COMPLIANCE_SOURCE). |
| <a id="pipelinecoverage"></a>`coverage` | [`Float`](#float) | Coverage percentage. | | <a id="pipelinecoverage"></a>`coverage` | [`Float`](#float) | Coverage percentage. |
| <a id="pipelinecreatedat"></a>`createdAt` | [`Time!`](#time) | Timestamp of the pipeline's creation. | | <a id="pipelinecreatedat"></a>`createdAt` | [`Time!`](#time) | Timestamp of the pipeline's creation. |
......
...@@ -920,6 +920,7 @@ export default { ...@@ -920,6 +920,7 @@ export default {
cancel_path: '/root/ci-mock/-/jobs/4757/cancel', cancel_path: '/root/ci-mock/-/jobs/4757/cancel',
new_issue_path: '/root/ci-mock/issues/new', new_issue_path: '/root/ci-mock/issues/new',
playable: false, playable: false,
complete: true,
created_at: threeWeeksAgo.toISOString(), created_at: threeWeeksAgo.toISOString(),
updated_at: threeWeeksAgo.toISOString(), updated_at: threeWeeksAgo.toISOString(),
finished_at: threeWeeksAgo.toISOString(), finished_at: threeWeeksAgo.toISOString(),
......
...@@ -8,6 +8,7 @@ export const mockPipelineResponse = { ...@@ -8,6 +8,7 @@ export const mockPipelineResponse = {
__typename: 'Pipeline', __typename: 'Pipeline',
id: 163, id: 163,
iid: '22', iid: '22',
complete: true,
usesNeeds: true, usesNeeds: true,
downstream: null, downstream: null,
upstream: null, upstream: null,
...@@ -570,6 +571,7 @@ export const wrappedPipelineReturn = { ...@@ -570,6 +571,7 @@ export const wrappedPipelineReturn = {
__typename: 'Pipeline', __typename: 'Pipeline',
id: 'gid://gitlab/Ci::Pipeline/175', id: 'gid://gitlab/Ci::Pipeline/175',
iid: '38', iid: '38',
complete: true,
usesNeeds: true, usesNeeds: true,
downstream: { downstream: {
__typename: 'PipelineConnection', __typename: 'PipelineConnection',
......
...@@ -9,7 +9,7 @@ RSpec.describe Types::Ci::PipelineType do ...@@ -9,7 +9,7 @@ RSpec.describe Types::Ci::PipelineType do
it 'contains attributes related to a pipeline' do it 'contains attributes related to a pipeline' do
expected_fields = %w[ expected_fields = %w[
id iid sha before_sha status detailed_status config_source id iid sha before_sha complete status detailed_status config_source
duration queued_duration duration queued_duration
coverage created_at updated_at started_at finished_at committed_at coverage created_at updated_at started_at finished_at committed_at
stages user retryable cancelable jobs source_job job downstream stages user retryable cancelable jobs source_job job downstream
......
...@@ -21,6 +21,10 @@ RSpec.describe JobEntity do ...@@ -21,6 +21,10 @@ RSpec.describe JobEntity do
subject { entity.as_json } subject { entity.as_json }
it 'contains complete to indicate if a pipeline is completed' do
expect(subject).to include(:complete)
end
it 'contains paths to job page action' do it 'contains paths to job page action' do
expect(subject).to include(:build_path) expect(subject).to include(:build_path)
end end
......
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