diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 08:43:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 08:43:02 +0000 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /danger | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) | |
download | gitlab-ce-d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb.tar.gz |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'danger')
-rw-r--r-- | danger/database/Dangerfile | 4 | ||||
-rw-r--r-- | danger/pajamas/Dangerfile | 4 | ||||
-rw-r--r-- | danger/plugins/specs.rb | 10 | ||||
-rw-r--r-- | danger/product_intelligence/Dangerfile | 10 | ||||
-rw-r--r-- | danger/roulette/Dangerfile | 3 | ||||
-rw-r--r-- | danger/specs/Dangerfile | 19 |
6 files changed, 34 insertions, 16 deletions
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile index 3018196ddbc..693c03b9dad 100644 --- a/danger/database/Dangerfile +++ b/danger/database/Dangerfile @@ -33,7 +33,7 @@ MSG DATABASE_APPROVED_LABEL = 'database::approved' non_geo_db_schema_updated = !git.modified_files.grep(%r{\Adb/structure\.sql}).empty? -geo_db_schema_updated = !git.modified_files.grep(%r{\Aee/db/geo/schema\.rb}).empty? +geo_db_schema_updated = !git.modified_files.grep(%r{\Aee/db/geo/structure\.sql}).empty? non_geo_migration_created = !git.added_files.grep(%r{\A(db/(post_)?migrate)/}).empty? geo_migration_created = !git.added_files.grep(%r{\Aee/db/geo/(post_)?migrate/}).empty? @@ -45,7 +45,7 @@ if non_geo_migration_created && !non_geo_db_schema_updated end if geo_migration_created && !geo_db_schema_updated - warn format(format_str, migrations: 'Geo migrations', schema: helper.html_link("ee/db/geo/schema.rb")) + warn format(format_str, migrations: 'Geo migrations', schema: helper.html_link("ee/db/geo/structure.sql")) end return unless helper.ci? diff --git a/danger/pajamas/Dangerfile b/danger/pajamas/Dangerfile index a3ff1126bd1..fde12c08b35 100644 --- a/danger/pajamas/Dangerfile +++ b/danger/pajamas/Dangerfile @@ -59,7 +59,7 @@ MARKDOWN if blocking_components_in_mr.any? markdown(<<~MARKDOWN) - These deprecated components have already been migrated and can no longer be used. Please use [Pajamas components](https://design.gitlab.com/components/status/) instead. + These deprecated components have already been migrated and can no longer be used. Please use [Pajamas components](https://design.gitlab.com/components/overview) instead. * #{blocking_components_in_mr.join("\n* ")} @@ -70,7 +70,7 @@ end if deprecated_components_in_mr.any? markdown(<<~MARKDOWN) - These deprecated components are in the process of being migrated. Please consider using [Pajamas components](https://design.gitlab.com/components/status/) instead. + These deprecated components are in the process of being migrated. Please consider using [Pajamas components](https://design.gitlab.com/components/overview) instead. * #{deprecated_components_in_mr.join("\n* ")} diff --git a/danger/plugins/specs.rb b/danger/plugins/specs.rb new file mode 100644 index 00000000000..3188785487e --- /dev/null +++ b/danger/plugins/specs.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require_relative '../../tooling/danger/specs' + +module Danger + class Specs < ::Danger::Plugin + # Put the helper code somewhere it can be tested + include Tooling::Danger::Specs + end +end diff --git a/danger/product_intelligence/Dangerfile b/danger/product_intelligence/Dangerfile index ae58cf4588c..fd6ae76b4f1 100644 --- a/danger/product_intelligence/Dangerfile +++ b/danger/product_intelligence/Dangerfile @@ -5,19 +5,19 @@ CHANGED_FILES_MESSAGE = <<~MSG For the following files, a review from the [Data team and Product Intelligence team](https://gitlab.com/groups/gitlab-org/growth/product-intelligence/engineers/-/group_members?with_inherited_permissions=exclude) is recommended Please check the ~"product intelligence" [guide](https://docs.gitlab.com/ee/development/usage_ping.html). +For MR review guidelines, see the [Service Ping review guidelines](https://docs.gitlab.com/ee/development/usage_ping/review_guidelines.html) or the [Snowplow review guidelines](https://docs.gitlab.com/ee/development/snowplow/review_guidelines.html). %<changed_files>s MSG -# exit if not matching files +# exit if not matching files or if no product intelligence labels matching_changed_files = product_intelligence.matching_changed_files -return unless matching_changed_files.any? +labels = product_intelligence.missing_labels -warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files)) +return if matching_changed_files.empty? || labels.empty? -labels = product_intelligence.missing_labels -return unless labels.any? +warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files)) gitlab.api.update_merge_request(gitlab.mr_json['project_id'], gitlab.mr_json['iid'], diff --git a/danger/roulette/Dangerfile b/danger/roulette/Dangerfile index cd23028a379..54b46807241 100644 --- a/danger/roulette/Dangerfile +++ b/danger/roulette/Dangerfile @@ -99,6 +99,9 @@ categories << :database if helper.mr_labels.include?('database') # 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") +# Skip Product intelligence reviews for growth experiment MRs +categories.delete(:product_intelligence) unless helper.mr_labels.include?("growth experiment") + if changes.any? project = project_helper.project_name diff --git a/danger/specs/Dangerfile b/danger/specs/Dangerfile index 35476ae645d..117eaf61062 100644 --- a/danger/specs/Dangerfile +++ b/danger/specs/Dangerfile @@ -20,7 +20,7 @@ Please make sure the spec files pass in AS-IF-FOSS mode either: 1. Locally with `FOSS_ONLY=1 bin/rspec -- %<spec_files>s`. 1. In the MR pipeline by verifying that the `rspec foss-impact` job has passed. -1. In the MR pipelines by including `RUN AS-IF-FOSS` in the MR title (you can do it with the ``/title %<mr_title>s [RUN AS-IF-FOSS]`` quick action) and start a new MR pipeline. +1. In the MR pipelines by setting the ~"pipeline:run-as-if-foss" label on the MR (you can do it with the `/label ~"pipeline:run-as-if-foss"` quick action) and start a new MR pipeline. MSG @@ -32,11 +32,12 @@ request specs (and/or feature specs). Please add request specs under See https://gitlab.com/groups/gitlab-org/-/epics/5076 for information. MSG -has_app_changes = helper.all_changed_files.grep(%r{\A(app|lib|db/(geo/)?(post_)?migrate)/}).any? -has_ee_app_changes = helper.all_changed_files.grep(%r{\Aee/(app|lib|db/(geo/)?(post_)?migrate)/}).any? -spec_changes = helper.all_changed_files.grep(%r{\Aspec/}) +all_changed_files = helper.all_changed_files +has_app_changes = all_changed_files.grep(%r{\A(app|lib|db/(geo/)?(post_)?migrate)/}).any? +has_ee_app_changes = all_changed_files.grep(%r{\Aee/(app|lib|db/(geo/)?(post_)?migrate)/}).any? +spec_changes = specs.changed_specs_files(ee: :exclude) has_spec_changes = spec_changes.any? -has_ee_spec_changes = helper.all_changed_files.grep(%r{\Aee/spec/}).any? +has_ee_spec_changes = specs.changed_specs_files(ee: :only).any? new_specs_needed = (gitlab.mr_labels & NO_SPECS_LABELS).empty? if (has_app_changes || has_ee_app_changes) && !(has_spec_changes || has_ee_spec_changes) && new_specs_needed @@ -45,10 +46,14 @@ end # The only changes outside `ee/` are in `spec/` if has_ee_app_changes && has_spec_changes && !(has_app_changes || has_ee_spec_changes) - warn format(EE_CHANGE_WITH_FOSS_SPEC_CHANGE_MESSAGE, spec_files: spec_changes.join(" "), mr_title: gitlab.mr_json['title']), sticky: false + warn format(EE_CHANGE_WITH_FOSS_SPEC_CHANGE_MESSAGE, spec_files: spec_changes.join(" ")), sticky: false end # Forbidding a new file addition under `/spec/controllers` or `/ee/spec/controllers` -if git.added_files.grep(%r{^(ee/)?spec/controllers/}).any? +if project_helper.changes.added.files.grep(%r{^(ee/)?spec/controllers/}).any? warn CONTROLLER_SPEC_DEPRECATION_MESSAGE end + +specs.changed_specs_files.each do |filename| + specs.add_suggestions_for_match_with_array(filename) +end |