Commit 18367695 authored by Miguel Rincon's avatar Miguel Rincon

MRs are not blocked unless pipeline must succeed

This change allows merge requests with "blocked" pipelines (pipelines
that are in wait of manual actions) to be merged when
pipelines must not succeed in order to be merged.
parent f2982a31
......@@ -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