summaryrefslogtreecommitdiff
path: root/danger
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-20 13:37:47 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-20 13:37:47 +0000
commitaee0a117a889461ce8ced6fcf73207fe017f1d99 (patch)
tree891d9ef189227a8445d83f35c1b0fc99573f4380 /danger
parent8d46af3258650d305f53b819eabf7ab18d22f59e (diff)
downloadgitlab-ce-aee0a117a889461ce8ced6fcf73207fe017f1d99.tar.gz
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'danger')
-rw-r--r--danger/ci_config/Dangerfile20
-rw-r--r--danger/ci_templates/Dangerfile2
-rw-r--r--danger/database/Dangerfile2
-rw-r--r--danger/documentation/Dangerfile2
-rw-r--r--danger/product_intelligence/Dangerfile8
-rw-r--r--danger/roulette/Dangerfile12
-rw-r--r--danger/specialization_labels/Dangerfile2
-rw-r--r--danger/specs/Dangerfile2
8 files changed, 34 insertions, 16 deletions
diff --git a/danger/ci_config/Dangerfile b/danger/ci_config/Dangerfile
new file mode 100644
index 00000000000..5022ccc1539
--- /dev/null
+++ b/danger/ci_config/Dangerfile
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+all_changed_files = helper.all_changed_files
+
+def get_ci_config_files(files)
+ files.select do |file|
+ file.include?('gitlab/ci/config/entry')
+ end
+end
+
+schema_path = 'app/assets/javascripts/editor/schema/ci.json'
+has_schema_update = all_changed_files.include?(schema_path)
+return if has_schema_update
+
+ci_config_files = get_ci_config_files(all_changed_files)
+return if ci_config_files.empty?
+
+file_list = "- #{ci_config_files.map { |path| "`#{path}`" }.join("\n- ")}"
+
+warn "This merge request changed CI config files but did not update the schema. Please consider updating [the schema](#{schema_path}) to reflect these changes:\n#{file_list}"
diff --git a/danger/ci_templates/Dangerfile b/danger/ci_templates/Dangerfile
index fcd9080e7d1..3d57436ef94 100644
--- a/danger/ci_templates/Dangerfile
+++ b/danger/ci_templates/Dangerfile
@@ -17,7 +17,7 @@ MSG
return unless helper.ci?
-template_paths_to_review = project_helper.changes_by_category[:ci_template]
+template_paths_to_review = helper.changes_by_category[:ci_template]
if gitlab.mr_labels.include?('ci::templates') || template_paths_to_review.any?
message 'This merge request adds or changes files that require a ' \
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile
index 70adbb4c139..b4e06c21fe4 100644
--- a/danger/database/Dangerfile
+++ b/danger/database/Dangerfile
@@ -51,7 +51,7 @@ end
return unless helper.ci?
return if gitlab.mr_labels.include?(DATABASE_APPROVED_LABEL)
-db_paths_to_review = project_helper.changes_by_category[:database]
+db_paths_to_review = helper.changes_by_category[:database]
if gitlab.mr_labels.include?('database') || db_paths_to_review.any?
message 'This merge request adds or changes files that require a ' \
diff --git a/danger/documentation/Dangerfile b/danger/documentation/Dangerfile
index 01ef5dbb49e..918c787075e 100644
--- a/danger/documentation/Dangerfile
+++ b/danger/documentation/Dangerfile
@@ -13,7 +13,7 @@ For more information, see:
- The [definition of done](https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#definition-of-done) documentation.
MSG
-docs_paths_to_review = project_helper.changes_by_category[:docs]
+docs_paths_to_review = helper.changes_by_category[:docs]
# Documentation should be updated for feature::addition and feature::enhancement
if docs_paths_to_review.empty?
diff --git a/danger/product_intelligence/Dangerfile b/danger/product_intelligence/Dangerfile
index eedb9b89d22..01a2f9b6feb 100644
--- a/danger/product_intelligence/Dangerfile
+++ b/danger/product_intelligence/Dangerfile
@@ -12,11 +12,11 @@ For MR review guidelines, see the [Service Ping review guidelines](https://docs.
MSG
# exit if not matching files or if no product intelligence labels
-product_intelligence_paths_to_review = project_helper.changes_by_category[:product_intelligence]
+product_intelligence_paths_to_review = helper.changes_by_category[:product_intelligence]
labels_to_add = product_intelligence.missing_labels
-return if product_intelligence_paths_to_review.empty? || labels_to_add.empty?
+return if product_intelligence_paths_to_review.empty? || product_intelligence.skip_review?
-warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(product_intelligence_paths_to_review))
+warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(product_intelligence_paths_to_review)) unless product_intelligence.has_approved_label?
-project_helper.labels_to_add.concat(labels_to_add)
+project_helper.labels_to_add.concat(labels_to_add) unless labels_to_add.empty?
diff --git a/danger/roulette/Dangerfile b/danger/roulette/Dangerfile
index 4eb1d987d84..8d1b14d3b9a 100644
--- a/danger/roulette/Dangerfile
+++ b/danger/roulette/Dangerfile
@@ -49,8 +49,8 @@ for them.
MARKDOWN
def group_not_available_template(slack_channel, gitlab_group)
- <<~TEMPLATE
- No engineer is available for automated assignment, please reach out to `#{slack_channel}` slack channel or mention `#{gitlab_group}` for assistance.
+ <<~TEMPLATE.strip
+ No engineer is available for automated assignment, please reach out to the `#{slack_channel}` Slack channel or mention `#{gitlab_group}` for assistance.
TEMPLATE
end
@@ -89,7 +89,7 @@ def markdown_row_for_spins(category, spins_array)
"| #{helper.label_for_category(category)} | #{reviewer_note} | #{maintainer_note} |"
end
-changes = project_helper.changes_by_category
+changes = helper.changes_by_category
# Ignore any files that are known but uncategorized. Prompt for any unknown files
changes.delete(:none)
@@ -111,12 +111,10 @@ categories << :ux if (["UX", "Community contribution"] - helper.mr_labels).empty
categories << :product_intelligence if helper.mr_labels.include?("product intelligence::review pending")
# Skip Product intelligence reviews for growth experiment MRs
-categories.delete(:product_intelligence) unless helper.mr_labels.include?("growth experiment")
+categories.delete(:product_intelligence) if helper.mr_labels.include?("growth experiment")
if changes.any?
- project = project_helper.project_name
-
- random_roulette_spins = roulette.spin(project, categories, timezone_experiment: false)
+ random_roulette_spins = roulette.spin(nil, categories, timezone_experiment: false)
rows = random_roulette_spins.map do |spin|
markdown_row_for_spins(spin.category, [spin])
diff --git a/danger/specialization_labels/Dangerfile b/danger/specialization_labels/Dangerfile
index 24a759cddc8..cb4c8c96f4f 100644
--- a/danger/specialization_labels/Dangerfile
+++ b/danger/specialization_labels/Dangerfile
@@ -14,7 +14,7 @@ SPECIALIZATIONS = {
feature_flag: 'feature flag'
}.freeze
-labels_to_add = project_helper.changes_by_category.each_with_object([]) do |(category, _changes), memo|
+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)
diff --git a/danger/specs/Dangerfile b/danger/specs/Dangerfile
index 067fb62807a..c4f609f5806 100644
--- a/danger/specs/Dangerfile
+++ b/danger/specs/Dangerfile
@@ -50,7 +50,7 @@ if has_ee_app_changes && has_spec_changes && !(has_app_changes || has_ee_spec_ch
end
# Forbidding a new file addition under `/spec/controllers` or `/ee/spec/controllers`
-if project_helper.changes.added.files.grep(%r{^(ee/)?spec/controllers/}).any?
+if helper.changes.added.files.grep(%r{^(ee/)?spec/controllers/}).any?
warn CONTROLLER_SPEC_DEPRECATION_MESSAGE
end