Commit bfddef57 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'ph/ph/fixWidgetGraphqlPipelineWarnings' into 'master'

Fixes GraphQL pipeline status notification with warnings

See merge request gitlab-org/gitlab!54089
parents 6b3ab4fa b591dcbe
...@@ -14,6 +14,7 @@ query getState($projectPath: ID!, $iid: String!) { ...@@ -14,6 +14,7 @@ query getState($projectPath: ID!, $iid: String!) {
pipelines(first: 1) { pipelines(first: 1) {
nodes { nodes {
status status
warnings
} }
} }
shouldBeRebased shouldBeRebased
......
...@@ -172,6 +172,11 @@ export default class MergeRequestStore { ...@@ -172,6 +172,11 @@ export default class MergeRequestStore {
this.canBeMerged = mergeRequest.mergeStatus === 'can_be_merged'; this.canBeMerged = mergeRequest.mergeStatus === 'can_be_merged';
this.canMerge = mergeRequest.userPermissions.canMerge; this.canMerge = mergeRequest.userPermissions.canMerge;
this.ciStatus = pipeline?.status.toLowerCase(); this.ciStatus = pipeline?.status.toLowerCase();
if (pipeline?.warnings && this.ciStatus === 'success') {
this.ciStatus = `${this.ciStatus}-with-warnings`;
}
this.commitsCount = mergeRequest.commitCount || 10; this.commitsCount = mergeRequest.commitCount || 10;
this.branchMissing = !mergeRequest.sourceBranchExists || !mergeRequest.targetBranchExists; this.branchMissing = !mergeRequest.sourceBranchExists || !mergeRequest.targetBranchExists;
this.hasConflicts = mergeRequest.conflicts; this.hasConflicts = mergeRequest.conflicts;
......
...@@ -27,6 +27,9 @@ module Types ...@@ -27,6 +27,9 @@ module Types
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})"
field :warnings, GraphQL::BOOLEAN_TYPE, null: false, method: :has_warnings?,
description: "Indicates if a pipeline has warnings."
field :detailed_status, Types::Ci::DetailedStatusType, null: false, field :detailed_status, Types::Ci::DetailedStatusType, null: false,
description: 'Detailed status of the pipeline.' description: 'Detailed status of the pipeline.'
......
---
title: Added warnings field to the pipelines GraphQL type
merge_request: 54089
author:
type: added
...@@ -18566,6 +18566,11 @@ type Pipeline { ...@@ -18566,6 +18566,11 @@ type Pipeline {
Permissions for the current user on the resource Permissions for the current user on the resource
""" """
userPermissions: PipelinePermissions! userPermissions: PipelinePermissions!
"""
Indicates if a pipeline has warnings.
"""
warnings: Boolean!
} }
type PipelineAnalytics { type PipelineAnalytics {
......
...@@ -54399,6 +54399,24 @@ ...@@ -54399,6 +54399,24 @@
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
},
{
"name": "warnings",
"description": "Indicates if a pipeline has warnings.",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
} }
], ],
"inputFields": null, "inputFields": null,
...@@ -2807,6 +2807,7 @@ Information about pagination in a connection.. ...@@ -2807,6 +2807,7 @@ Information about pagination in a connection..
| `upstream` | Pipeline | Pipeline that triggered the pipeline. | | `upstream` | Pipeline | Pipeline that triggered the pipeline. |
| `user` | User | Pipeline user. | | `user` | User | Pipeline user. |
| `userPermissions` | PipelinePermissions! | Permissions for the current user on the resource | | `userPermissions` | PipelinePermissions! | Permissions for the current user on the resource |
| `warnings` | Boolean! | Indicates if a pipeline has warnings. |
### PipelineAnalytics ### PipelineAnalytics
......
...@@ -12,7 +12,7 @@ RSpec.describe Types::Ci::PipelineType do ...@@ -12,7 +12,7 @@ RSpec.describe Types::Ci::PipelineType do
id iid sha before_sha status detailed_status config_source duration id iid sha before_sha status detailed_status config_source 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 downstream stages user retryable cancelable jobs source_job downstream
upstream path project active user_permissions upstream path project active user_permissions warnings
] ]
if Gitlab.ee? if Gitlab.ee?
......
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