diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /tooling/danger | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'tooling/danger')
-rw-r--r-- | tooling/danger/datateam.rb | 15 | ||||
-rw-r--r-- | tooling/danger/project_helper.rb | 8 |
2 files changed, 18 insertions, 5 deletions
diff --git a/tooling/danger/datateam.rb b/tooling/danger/datateam.rb index b3779aa13bb..dfa8e1549ef 100644 --- a/tooling/danger/datateam.rb +++ b/tooling/danger/datateam.rb @@ -15,6 +15,7 @@ module Tooling DATA_WAREHOUSE_SCOPE = 'Data Warehouse::' FILE_PATH_REGEX = %r{((ee|jh)/)?config/metrics(/.+\.yml)}.freeze PERFORMANCE_INDICATOR_REGEX = %r{gmau|smau|paid_gmau|umau}.freeze + METRIC_REMOVED = %r{\+status: removed}.freeze DATABASE_REGEX = %r{\Adb/structure\.sql}.freeze STRUCTURE_SQL_FILE = %w(db/structure.sql).freeze @@ -31,18 +32,18 @@ module Tooling private def data_warehouse_impact_files - @impacted_files ||= (performance_indicator_changed_files + database_changed_files) + @impacted_files ||= (metrics_changed_files + database_changed_files) end def labelled_as_datawarehouse? helper.mr_labels.any? { |label| label.start_with?(DATA_WAREHOUSE_SCOPE) } end - def performance_indicator_changed_files + def metrics_changed_files metrics_definitions_files = helper.modified_files.grep(FILE_PATH_REGEX) metrics_definitions_files.select do |file| - helper.changed_lines(file).any? { |change| change =~ PERFORMANCE_INDICATOR_REGEX } + helper.changed_lines(file).any? { |change| performance_indicator_changed?(change) || status_removed?(change) } end.compact end @@ -53,6 +54,14 @@ module Tooling def database_changed_files helper.modified_files & STRUCTURE_SQL_FILE end + + def performance_indicator_changed?(change) + change =~ PERFORMANCE_INDICATOR_REGEX + end + + def status_removed?(change) + change =~ METRIC_REMOVED + end end end end diff --git a/tooling/danger/project_helper.rb b/tooling/danger/project_helper.rb index c0afd9b7319..dbe3e6edd98 100644 --- a/tooling/danger/project_helper.rb +++ b/tooling/danger/project_helper.rb @@ -101,9 +101,13 @@ module Tooling %r{\A\.editorconfig\z} => :tooling, %r{Dangerfile\z} => :tooling, %r{\A((ee|jh)/)?(danger/|tooling/danger/)} => :tooling, - %r{\A((ee|jh)/)?(lib/)?scripts/.*\.rb} => [:backend, :tooling], - %r{\A((ee|jh)/)?(lib/)?scripts/.*\.js} => [:frontend, :tooling], + + %r{\A((ee|jh)/)?scripts/(lib/)?glfm/.*\.rb} => [:backend], + %r{\A((ee|jh)/)?scripts/(lib/)?glfm/.*\.js} => [:frontend], + %r{\A((ee|jh)/)?scripts/.*\.rb} => [:backend, :tooling], + %r{\A((ee|jh)/)?scripts/.*\.js} => [:frontend, :tooling], %r{\A((ee|jh)/)?scripts/} => :tooling, + %r{\Atooling/} => :tooling, %r{(CODEOWNERS)} => :tooling, %r{(tests.yml)} => :tooling, |