Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/danger
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2019-07-04 21:47:16 +0300
committerMayra Cabrera <mcabrera@gitlab.com>2019-07-04 21:47:16 +0300
commit37e4d6d991ac8e712ea99c621f98831955b6ebf5 (patch)
tree75d76059e5df9d9b3c5622aa6dad0344dc9cc42f /danger
parent507dfc66b480c0df097daefe86bf3a6bb3b2210f (diff)
DRY up conditions for files require DB review
Stop using two separate lists for the conditions which files require a database review. Related discussion: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/30156#note_187732053
Diffstat (limited to 'danger')
-rw-r--r--danger/database/Dangerfile32
1 files changed, 1 insertions, 31 deletions
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile
index 4dadf60ad24..083e95b8da7 100644
--- a/danger/database/Dangerfile
+++ b/danger/database/Dangerfile
@@ -1,21 +1,5 @@
# frozen_string_literal: true
-# All the files/directories that should be reviewed by the DB team.
-DB_FILES = [
- 'db/',
- 'app/models/project_authorization.rb',
- 'app/services/users/refresh_authorized_projects_service.rb',
- 'lib/gitlab/background_migration.rb',
- 'lib/gitlab/background_migration/',
- 'lib/gitlab/database.rb',
- 'lib/gitlab/database/',
- 'lib/gitlab/github_import.rb',
- 'lib/gitlab/github_import/',
- 'lib/gitlab/sql/',
- 'rubocop/cop/migration',
- 'ee/lib/gitlab/database/'
-].freeze
-
SCHEMA_NOT_UPDATED_MESSAGE = <<~MSG
**New %<migrations>s added but %<schema>s wasn't updated.**
@@ -24,20 +8,6 @@ updated too (unless the migration isn't changing the DB schema
and isn't the most recent one).
MSG
-def database_paths_requiring_review(files)
- to_review = []
-
- files.each do |file|
- review = DB_FILES.any? do |pattern|
- file.start_with?(pattern)
- end
-
- to_review << file if review
- end
-
- to_review
-end
-
non_geo_db_schema_updated = !git.modified_files.grep(%r{\Adb/schema\.rb}).empty?
geo_db_schema_updated = !git.modified_files.grep(%r{\Aee/db/geo/schema\.rb}).empty?
@@ -52,7 +22,7 @@ if geo_migration_created && !geo_db_schema_updated
warn format(SCHEMA_NOT_UPDATED_MESSAGE, migrations: 'Geo migrations', schema: gitlab.html_link("ee/db/geo/schema.rb"))
end
-db_paths_to_review = database_paths_requiring_review(helper.all_changed_files)
+db_paths_to_review = helper.changes_by_category[:database]
unless db_paths_to_review.empty?
message 'This merge request adds or changes files that require a ' \