summaryrefslogtreecommitdiff
path: root/danger
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-03-24 00:07:27 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-03-24 00:07:27 +0000
commit179b33c5465649ee5d020f70604f1b02473fc702 (patch)
treef2883044ea8126a7b5774ec2ff7750940a443246 /danger
parentbbc06065aa40c3d0d037bea16081f4f5c969053e (diff)
downloadgitlab-ce-179b33c5465649ee5d020f70604f1b02473fc702.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'danger')
-rw-r--r--danger/Dangerfile-bundle_size (renamed from danger/bundle_size/Dangerfile)1
-rw-r--r--danger/ci_templates/Dangerfile2
-rw-r--r--danger/database/Dangerfile4
-rw-r--r--danger/feature_flag/Dangerfile8
-rw-r--r--danger/specialization_labels/Dangerfile4
-rw-r--r--danger/specs/Dangerfile2
-rw-r--r--danger/z_metadata/Dangerfile6
7 files changed, 14 insertions, 13 deletions
diff --git a/danger/bundle_size/Dangerfile b/danger/Dangerfile-bundle_size
index b824edb5dab..23ab726096e 100644
--- a/danger/bundle_size/Dangerfile
+++ b/danger/Dangerfile-bundle_size
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+# This file isn't named "Dangerfile" so that it's not imported by default since it's only meant to be run in the `bundle-size-review` job.
analysis_result = "./bundle-size-review/analysis.json"
markdown_result = "./bundle-size-review/comparison.md"
diff --git a/danger/ci_templates/Dangerfile b/danger/ci_templates/Dangerfile
index 3d57436ef94..ace9905e91d 100644
--- a/danger/ci_templates/Dangerfile
+++ b/danger/ci_templates/Dangerfile
@@ -19,7 +19,7 @@ return unless helper.ci?
template_paths_to_review = helper.changes_by_category[:ci_template]
-if gitlab.mr_labels.include?('ci::templates') || template_paths_to_review.any?
+if helper.mr_labels.include?('ci::templates') || template_paths_to_review.any?
message 'This merge request adds or changes files that require a ' \
'review from the CI/CD Templates maintainers.'
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile
index 0128f0fa195..f94184263ad 100644
--- a/danger/database/Dangerfile
+++ b/danger/database/Dangerfile
@@ -49,11 +49,11 @@ if geo_migration_created && !geo_db_schema_updated
end
return unless helper.ci?
-return if gitlab.mr_labels.include?(DATABASE_APPROVED_LABEL)
+return if helper.mr_labels.include?(DATABASE_APPROVED_LABEL)
db_paths_to_review = helper.changes_by_category[:database]
-if gitlab.mr_labels.include?('database') || db_paths_to_review.any?
+if helper.mr_labels.include?('database') || db_paths_to_review.any?
message 'This merge request adds or changes files that require a ' \
'review from the [Database team](https://gitlab.com/groups/gl-database/-/group_members).'
diff --git a/danger/feature_flag/Dangerfile b/danger/feature_flag/Dangerfile
index 5fe9d42a7a1..d5b907377aa 100644
--- a/danger/feature_flag/Dangerfile
+++ b/danger/feature_flag/Dangerfile
@@ -22,21 +22,21 @@ def check_feature_flag_yaml(feature_flag)
end
rescue Psych::Exception
# YAML could not be parsed, fail the build.
- fail "#{gitlab.html_link(feature_flag.path)} isn't valid YAML! #{SEE_DOC}"
+ fail "#{helper.html_link(feature_flag.path)} isn't valid YAML! #{SEE_DOC}"
rescue StandardError => e
warn "There was a problem trying to check the Feature Flag file. Exception: #{e.class.name} - #{e.message}"
end
def message_for_feature_flag_missing_group!(feature_flag:, mr_group_label:)
if mr_group_label.nil?
- warn "Consider setting `group` in #{gitlab.html_link(feature_flag.path)}. #{SEE_DOC}"
+ warn "Consider setting `group` in #{helper.html_link(feature_flag.path)}. #{SEE_DOC}"
else
mr_line = feature_flag.raw.lines.find_index("group:\n")
if mr_line
markdown(format(SUGGEST_MR_COMMENT, group: mr_group_label), file: feature_flag.path, line: mr_line.succ)
else
- warn %(Consider setting `group: "#{mr_group_label}"` in #{gitlab.html_link(feature_flag.path)}. #{SEE_DOC})
+ warn %(Consider setting `group: "#{mr_group_label}"` in #{helper.html_link(feature_flag.path)}. #{SEE_DOC})
end
end
end
@@ -60,7 +60,7 @@ def message_for_feature_flag_with_group!(feature_flag:, mr_group_label:)
if mr_group_label.nil?
helper.labels_to_add << feature_flag.group
else
- fail %(`group` is set to ~"#{feature_flag.group}" in #{gitlab.html_link(feature_flag.path)}, which does not match ~"#{mr_group_label}" set on the MR!)
+ fail %(`group` is set to ~"#{feature_flag.group}" in #{helper.html_link(feature_flag.path)}, which does not match ~"#{mr_group_label}" set on the MR!)
end
end
diff --git a/danger/specialization_labels/Dangerfile b/danger/specialization_labels/Dangerfile
index f161c470f36..615ceb8625d 100644
--- a/danger/specialization_labels/Dangerfile
+++ b/danger/specialization_labels/Dangerfile
@@ -16,11 +16,11 @@ SPECIALIZATIONS = {
labels_to_add = helper.changes_by_category.each_with_object([]) do |(category, _changes), memo|
label = SPECIALIZATIONS[category]
next unless label
- next if gitlab.mr_labels.include?(label)
+ next if helper.mr_labels.include?(label)
# Don't override already-set scoped labels.
label_scope = label.split('::')[0...-1].join('::')
- next if !label_scope.empty? && gitlab.mr_labels.any? { |mr_label| mr_label.start_with?(label_scope) }
+ next if !label_scope.empty? && helper.has_scoped_label_with_scope?(label_scope)
memo << label
end
diff --git a/danger/specs/Dangerfile b/danger/specs/Dangerfile
index 8ef046f7bc1..dc9809b20b5 100644
--- a/danger/specs/Dangerfile
+++ b/danger/specs/Dangerfile
@@ -37,7 +37,7 @@ has_ee_app_changes = all_changed_files.grep(%r{\Aee/(app|lib|db/(geo/)?(post_)?m
spec_changes = specs.changed_specs_files(ee: :exclude)
has_spec_changes = spec_changes.any?
has_ee_spec_changes = specs.changed_specs_files(ee: :only).any?
-new_specs_needed = (gitlab.mr_labels & NO_SPECS_LABELS).empty?
+new_specs_needed = (helper.mr_labels & NO_SPECS_LABELS).empty?
if (has_app_changes || has_ee_app_changes) && !(has_spec_changes || has_ee_spec_changes) && new_specs_needed
warn format(NO_NEW_SPEC_MESSAGE, labels: helper.labels_list(NO_SPECS_LABELS)), sticky: false
diff --git a/danger/z_metadata/Dangerfile b/danger/z_metadata/Dangerfile
index 546fdc8de5f..8aeb0c33a9c 100644
--- a/danger/z_metadata/Dangerfile
+++ b/danger/z_metadata/Dangerfile
@@ -14,12 +14,12 @@ end
has_milestone = !gitlab.mr_json["milestone"].nil?
-unless has_milestone || (helper.security_mr? && gitlab.branch_for_base == DEFAULT_BRANCH)
+unless has_milestone || (helper.security_mr? && helper.mr_target_branch == DEFAULT_BRANCH)
warn "This merge request does not refer to an existing milestone.", sticky: false
end
-has_pick_into_stable_label = gitlab.mr_labels.find { |label| label.start_with?('Pick into') }
+has_pick_into_stable_label = helper.mr_labels.find { |label| label.start_with?('Pick into') }
-if gitlab.branch_for_base != DEFAULT_BRANCH && !has_pick_into_stable_label && !helper.security_mr?
+if helper.mr_target_branch != DEFAULT_BRANCH && !has_pick_into_stable_label && !helper.security_mr?
warn "Most of the time, merge requests should target `#{DEFAULT_BRANCH}`. Otherwise, please set the relevant `Pick into X.Y` label."
end