Skip to content
Snippets Groups Projects
Commit 4e1db2e7 authored by GitLab Release Tools Bot's avatar GitLab Release Tools Bot
Browse files

Merge branch 'security-mr-delete-source-branch-no-pipeline-17-4' into '17-4-stable-ee'

Do not create a pipeline on MR refresh if source branch was deleted

See merge request https://gitlab.com/gitlab-org/security/gitlab/-/merge_requests/4522



Merged-by: default avatarGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>
Approved-by: default avatarIgor Drozdov <idrozdov@gitlab.com>
Co-authored-by: default avatarPatrick Bajao <ebajao@gitlab.com>
parents 4936f481 66c4e57a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -44,7 +44,7 @@ def refresh_merge_requests!
mark_mr_as_draft_from_commits(mr)
execute_mr_web_hooks(mr)
# Run at the end of the loop to avoid any potential contention on the MR object
refresh_pipelines_on_merge_requests(mr)
refresh_pipelines_on_merge_requests(mr) unless @push.branch_removed?
merge_request_activity_counter.track_mr_including_ci_config(user: mr.author, merge_request: mr)
end
 
Loading
Loading
Loading
Loading
@@ -246,6 +246,18 @@
expect(@another_merge_request.has_commits?).to be_falsy
end
 
context 'when push is a branch removal' do
before do
# If @newrev is a blank SHA, it means the ref has been removed
@newrev = Gitlab::Git::SHA1_BLANK_SHA
end
it 'does not create detached merge request pipeline' do
expect { subject }
.not_to change { @merge_request.pipelines_for_merge_request.count }
end
end
context 'when "push_options: nil" is passed' do
let(:service_instance) { service.new(project: project, current_user: @user, params: { push_options: nil }) }
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment