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

Add latest changes from gitlab-org/gitlab@12-5-stable-ee

parent 94d4ea96
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -35,7 +35,7 @@ def check_changelog(path)
fail "`title` should be set, in #{gitlab.html_link(path)}! #{SEE_DOC}" if yaml["title"].nil?
fail "`type` should be set, in #{gitlab.html_link(path)}! #{SEE_DOC}" if yaml["type"].nil?
 
if yaml["merge_request"].nil?
if yaml["merge_request"].nil? && !helper.security_mr?
message "Consider setting `merge_request` to #{gitlab.mr_json["iid"]} in #{gitlab.html_link(path)}. #{SEE_DOC}"
elsif yaml["merge_request"] != gitlab.mr_json["iid"] && !ce_port_changelog?(path)
fail "Merge request ID was not set to #{gitlab.mr_json["iid"]}! #{SEE_DOC}"
Loading
Loading
Loading
Loading
@@ -32,7 +32,7 @@ end
 
has_pick_into_stable_label = gitlab.mr_labels.find { |label| label.start_with?('Pick into') }
 
if gitlab.branch_for_base != "master" && !has_pick_into_stable_label
if gitlab.branch_for_base != "master" && !has_pick_into_stable_label && !helper.security_mr?
warn "Most of the time, merge requests should target `master`. Otherwise, please set the relevant `Pick into X.Y` label."
end
 
Loading
Loading
Loading
Loading
@@ -171,6 +171,12 @@ module Gitlab
labels - current_mr_labels
end
 
def security_mr?
return false unless gitlab_helper
gitlab_helper.mr_json['web_url'].include?('/gitlab-org/security/')
end
private
 
def has_database_scoped_labels?(current_mr_labels)
Loading
Loading
Loading
Loading
@@ -319,4 +319,26 @@ describe Gitlab::Danger::Helper do
it { is_expected.to match_array(['database', 'database::review pending']) }
end
end
describe '#security_mr?' do
it 'returns false when `gitlab_helper` is unavailable' do
expect(helper).to receive(:gitlab_helper).and_return(nil)
expect(helper).not_to be_security_mr
end
it 'returns false when on a normal merge request' do
expect(fake_gitlab).to receive(:mr_json)
.and_return('web_url' => 'https://gitlab.com/gitlab-org/gitlab/merge_requests/1')
expect(helper).not_to be_security_mr
end
it 'returns true when on a security merge request' do
expect(fake_gitlab).to receive(:mr_json)
.and_return('web_url' => 'https://gitlab.com/gitlab-org/security/gitlab/merge_requests/1')
expect(helper).to be_security_mr
end
end
end
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
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