Commit 1c8e99be authored by Shinya Maeda's avatar Shinya Maeda

Ignore merge if the status of the merge request pipeline is stale

Merge request pipeline is meant for ensuring target branch's pipeline
green. We should not let maintainers merge a merge request if the head
pipeline of the merge request doesn't fulfill the criteria.
parent 74ace2a4
...@@ -1353,7 +1353,12 @@ describe API::MergeRequests do ...@@ -1353,7 +1353,12 @@ describe API::MergeRequests do
end end
it 'returns 405 if the build failed for a merge request that requires success' do it 'returns 405 if the build failed for a merge request that requires success' do
allow_any_instance_of(MergeRequest).to receive(:mergeable_ci_state?).and_return(false) project.update!(only_allow_merge_if_pipeline_succeeds: true)
create(:ci_pipeline,
:failed,
sha: merge_request.diff_head_sha,
merge_requests_as_head_pipeline: [merge_request])
put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/merge", user) put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/merge", user)
......
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