Commit b6104e73 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch...

Merge branch '20426-allow-mr-to-merge-when-pipeline-blocked-and-pipeline-must-succeed-is-not-enabled' into 'master'

MRs aren't blocked when their pipelines are blocked unless 'Pipeline must succeed' is checked

See merge request gitlab-org/gitlab!42207
parents fe94919d 18367695
......@@ -102,7 +102,8 @@ export default class MergeRequestStore {
this.isPipelineSkipped = this.ciStatus === 'skipped';
this.pipelineDetailedStatus = pipelineStatus;
this.isPipelineActive = data.pipeline ? data.pipeline.active : false;
this.isPipelineBlocked = pipelineStatus ? pipelineStatus.group === 'manual' : false;
this.isPipelineBlocked =
data.only_allow_merge_if_pipeline_succeeds && pipelineStatus?.group === 'manual';
this.ciStatusFaviconPath = pipelineStatus ? pipelineStatus.favicon : null;
this.terraformReportsPath = data.terraform_reports_path;
this.testResultsPath = data.test_reports_path;
......
---
title: Merge Requests are not blocked when their pipelines are waiting for manual
actions unless 'Pipeline must succeed' is checked in the settings.
merge_request: 42207
author:
type: fixed
......@@ -127,8 +127,10 @@ RSpec.describe 'Merge request > User sees merge widget', :js do
end
end
context 'when merge request is in the blocked pipeline state' do
context 'when merge request is in the blocked pipeline state and pipeline must succeed' do
before do
project.update_attribute(:only_allow_merge_if_pipeline_succeeds, true)
create(
:ci_pipeline,
project: project,
......
......@@ -69,6 +69,38 @@ describe('MergeRequestStore', () => {
});
});
describe('isPipelineBlocked', () => {
const pipelineWaitingForManualAction = {
details: {
status: {
group: 'manual',
},
},
};
it('should be `false` when the pipeline status is missing', () => {
store.setData({ ...mockData, pipeline: undefined });
expect(store.isPipelineBlocked).toBe(false);
});
it('should be `false` when the pipeline is waiting for manual action', () => {
store.setData({ ...mockData, pipeline: pipelineWaitingForManualAction });
expect(store.isPipelineBlocked).toBe(false);
});
it('should be `true` when the pipeline is waiting for manual action and the pipeline must succeed', () => {
store.setData({
...mockData,
pipeline: pipelineWaitingForManualAction,
only_allow_merge_if_pipeline_succeeds: true,
});
expect(store.isPipelineBlocked).toBe(true);
});
});
describe('isNothingToMergeState', () => {
it('returns true when nothingToMerge', () => {
store.state = stateKey.nothingToMerge;
......
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