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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-21 15:14:15 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-21 15:14:15 +0300
commit55e3b0c9100c453fa32055dc2c76bd7ebfa23a17 (patch)
treebe205a5fe067983f154884f724511ba6fdb2620e /danger
parent3442b76bbd896c85c06feaa56e3d9355a3945523 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'danger')
-rw-r--r--danger/datateam/Dangerfile18
1 files changed, 16 insertions, 2 deletions
diff --git a/danger/datateam/Dangerfile b/danger/datateam/Dangerfile
index 263fd4aa8e3..a4ccd65510d 100644
--- a/danger/datateam/Dangerfile
+++ b/danger/datateam/Dangerfile
@@ -6,14 +6,28 @@ DATA_WAREHOUSE_LABELS = [
"Data Warehouse::Not Impacted"
].freeze
+FILE_PATH_REGEX = %r{((ee|jh)/)?config/metrics(/.+\.yml)}.freeze
+PERFORMANCE_INDICATOR_REGEX = %r{gmau|smau|paid_gmau|umau}.freeze
+
CHANGED_SCHEMA_MESSAGE = <<~MSG
-Notification to the Data Team about changes to the db/structure.sql file, add label `Data Warehouse::Impact Check`.
+Notification to the Data Team about changes to files with possible impact on Data Warehouse, add label `Data Warehouse::Impact Check`.
/label ~"Data Warehouse::Impact Check"
+The following files require a review:
+
MSG
db_schema_updated = !git.modified_files.grep(%r{\Adb/structure\.sql}).empty?
+
+metrics_definitions_files = git.modified_files.grep(FILE_PATH_REGEX)
+
+data_warehouse_impact_files = metrics_definitions_files.select do |file|
+ helper.changed_lines(file).grep(PERFORMANCE_INDICATOR_REGEX).any?
+end.compact
+
+data_warehouse_impact_files << 'db/structure.sql' if db_schema_updated
+
no_data_warehouse_labels = (gitlab.mr_labels & DATA_WAREHOUSE_LABELS).empty?
-markdown(CHANGED_SCHEMA_MESSAGE) if db_schema_updated && no_data_warehouse_labels
+markdown(CHANGED_SCHEMA_MESSAGE + helper.markdown_list(data_warehouse_impact_files)) if data_warehouse_impact_files.any? && no_data_warehouse_labels