diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /danger | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'danger')
-rw-r--r-- | danger/database/Dangerfile | 4 | ||||
-rw-r--r-- | danger/feature_flag/Dangerfile | 4 | ||||
-rw-r--r-- | danger/pipeline/Dangerfile | 2 | ||||
-rw-r--r-- | danger/product_intelligence/Dangerfile | 12 | ||||
-rw-r--r-- | danger/roulette/Dangerfile | 13 | ||||
-rw-r--r-- | danger/specialization_labels/Dangerfile | 17 | ||||
-rw-r--r-- | danger/specs/Dangerfile | 2 | ||||
-rw-r--r-- | danger/z_metadata/Dangerfile (renamed from danger/metadata/Dangerfile) | 15 |
8 files changed, 37 insertions, 32 deletions
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile index 693c03b9dad..70adbb4c139 100644 --- a/danger/database/Dangerfile +++ b/danger/database/Dangerfile @@ -66,8 +66,6 @@ if gitlab.mr_labels.include?('database') || db_paths_to_review.any? end unless helper.has_database_scoped_labels? - gitlab.api.update_merge_request(gitlab.mr_json['project_id'], - gitlab.mr_json['iid'], - add_labels: 'database::review pending') + project_helper.labels_to_add << 'database::review pending' end end diff --git a/danger/feature_flag/Dangerfile b/danger/feature_flag/Dangerfile index 9b67590f117..d6c1c53cddc 100644 --- a/danger/feature_flag/Dangerfile +++ b/danger/feature_flag/Dangerfile @@ -58,9 +58,7 @@ def message_for_feature_flag_with_group!(feature_flag:, mr_group_label:) return if feature_flag.group_match_mr_label?(mr_group_label) if mr_group_label.nil? - gitlab.api.update_merge_request(gitlab.mr_json['project_id'], - gitlab.mr_json['iid'], - add_labels: feature_flag.group) + project_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!) end diff --git a/danger/pipeline/Dangerfile b/danger/pipeline/Dangerfile index 5503094ba50..861d031915e 100644 --- a/danger/pipeline/Dangerfile +++ b/danger/pipeline/Dangerfile @@ -14,7 +14,7 @@ Please consider the effect of the changes in this merge request on the following - personal forks - Effects on [pipeline performance](https://about.gitlab.com/handbook/engineering/quality/performance-indicators/#average-merge-request-pipeline-duration-for-gitlab) -Please consider communicating these changes to the broader team following the [communication guideline for pipeline changes](https://about.gitlab.com/handbook/engineering/quality/engineering-productivity-team/#pipeline-changes) +Please consider communicating these changes to the broader team following the [communication guideline for pipeline changes](https://about.gitlab.com/handbook/engineering/quality/engineering-productivity/#pipeline-changes) MESSAGE if helper.has_ci_changes? diff --git a/danger/product_intelligence/Dangerfile b/danger/product_intelligence/Dangerfile index fd6ae76b4f1..eedb9b89d22 100644 --- a/danger/product_intelligence/Dangerfile +++ b/danger/product_intelligence/Dangerfile @@ -12,13 +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 -matching_changed_files = product_intelligence.matching_changed_files -labels = product_intelligence.missing_labels +product_intelligence_paths_to_review = project_helper.changes_by_category[:product_intelligence] +labels_to_add = product_intelligence.missing_labels -return if matching_changed_files.empty? || labels.empty? +return if product_intelligence_paths_to_review.empty? || labels_to_add.empty? -warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files)) +warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(product_intelligence_paths_to_review)) -gitlab.api.update_merge_request(gitlab.mr_json['project_id'], - gitlab.mr_json['iid'], - add_labels: labels) +project_helper.labels_to_add.concat(labels_to_add) diff --git a/danger/roulette/Dangerfile b/danger/roulette/Dangerfile index 54b46807241..4eb1d987d84 100644 --- a/danger/roulette/Dangerfile +++ b/danger/roulette/Dangerfile @@ -48,10 +48,18 @@ Please consider creating a merge request to 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 +end + OPTIONAL_REVIEW_TEMPLATE = '%{role} review is optional for %{category}' NOT_AVAILABLE_TEMPLATES = { default: 'No %{role} available', - product_intelligence: "No engineer is available for automated assignment, please reach out to `#g_product_intelligence` slack channel or mention `@gitlab-org/growth/product-intelligence/engineers` for assistance." + product_intelligence: group_not_available_template('#g_product_intelligence', '@gitlab-org/growth/product-intelligence/engineers'), + integrations_be: group_not_available_template('#g_ecosystem_integrations', '@gitlab-org/ecosystem-stage/integrations'), + integrations_fe: group_not_available_template('#g_ecosystem_integrations', '@gitlab-org/ecosystem-stage/integrations') }.freeze def note_for_spins_role(spins, role, category) @@ -96,6 +104,9 @@ categories = Set.new(changes.keys - [:unknown]) # Ensure to spin for database reviewer/maintainer when ~database is applied (e.g. to review SQL queries) categories << :database if helper.mr_labels.include?('database') +# Ensure to spin for UX reviewer for community contributions when ~UX is applied (e.g. to review changes to the UI) +categories << :ux if (["UX", "Community contribution"] - helper.mr_labels).empty? + # Ensure to spin for Product Intelligence reviewer when ~"product intelligence::review pending" is applied categories << :product_intelligence if helper.mr_labels.include?("product intelligence::review pending") diff --git a/danger/specialization_labels/Dangerfile b/danger/specialization_labels/Dangerfile index e86d66f5fbc..24a759cddc8 100644 --- a/danger/specialization_labels/Dangerfile +++ b/danger/specialization_labels/Dangerfile @@ -6,21 +6,24 @@ SPECIALIZATIONS = { database: 'database', backend: 'backend', frontend: 'frontend', + ux: 'UX', docs: 'documentation', qa: 'QA', - tooling: 'tooling', + tooling: 'type::tooling', ci_template: 'ci::templates', feature_flag: 'feature flag' }.freeze labels_to_add = project_helper.changes_by_category.each_with_object([]) do |(category, _changes), memo| label = SPECIALIZATIONS[category] + next unless label + next if gitlab.mr_labels.include?(label) - memo << label if label && !gitlab.mr_labels.include?(label) -end + # 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) } -if labels_to_add.any? - gitlab.api.update_merge_request(gitlab.mr_json['project_id'], - gitlab.mr_json['iid'], - add_labels: labels_to_add.join(',')) + memo << label end + +project_helper.labels_to_add.concat(labels_to_add) if labels_to_add.any? diff --git a/danger/specs/Dangerfile b/danger/specs/Dangerfile index 117eaf61062..067fb62807a 100644 --- a/danger/specs/Dangerfile +++ b/danger/specs/Dangerfile @@ -1,7 +1,7 @@ # frozen_string_literal: true NO_SPECS_LABELS = [ - 'tooling', + 'type::tooling', 'tooling::pipelines', 'tooling::workflow', 'documentation', diff --git a/danger/metadata/Dangerfile b/danger/z_metadata/Dangerfile index 27dda687f6a..0a70554486f 100644 --- a/danger/metadata/Dangerfile +++ b/danger/z_metadata/Dangerfile @@ -4,24 +4,21 @@ DEFAULT_BRANCH = 'master' -THROUGHPUT_LABELS = [ - 'Community contribution', - 'security', - 'bug', - 'feature', +TYPE_LABELS = [ + 'type::feature', 'feature::addition', - 'feature::maintenance', - 'tooling', + 'type::maintenance', + 'type::tooling', 'tooling::pipelines', 'tooling::workflow', - 'documentation' + 'type::bug' ].freeze if gitlab.mr_body.size < 5 fail "Please provide a proper merge request description." end -if (THROUGHPUT_LABELS & gitlab.mr_labels).empty? +if (TYPE_LABELS & (gitlab.mr_labels + project_helper.labels_to_add)).empty? warn 'Please add a [merge request type](https://about.gitlab.com/handbook/engineering/metrics/#work-type-classification) to this merge request.' end |