summaryrefslogtreecommitdiff
path: root/tooling
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-25 09:12:21 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-25 09:12:21 +0000
commit45760607bc053b7379f81edd5ea91dd2a6471522 (patch)
tree3c23388962d7d0eb31fde246718fc91c6acf5c26 /tooling
parent0712a75cc03cb881dc40ae53a50d059822354ad8 (diff)
downloadgitlab-ce-45760607bc053b7379f81edd5ea91dd2a6471522.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'tooling')
-rw-r--r--tooling/danger/product_intelligence.rb57
-rw-r--r--tooling/danger/project_helper.rb10
2 files changed, 10 insertions, 57 deletions
diff --git a/tooling/danger/product_intelligence.rb b/tooling/danger/product_intelligence.rb
index 848f99eeff5..f56353cae61 100644
--- a/tooling/danger/product_intelligence.rb
+++ b/tooling/danger/product_intelligence.rb
@@ -9,26 +9,6 @@ module Tooling
'product intelligence::review pending'
].freeze
- TRACKING_FILES = [
- 'lib/gitlab/tracking.rb',
- 'spec/lib/gitlab/tracking_spec.rb',
- 'app/helpers/tracking_helper.rb',
- 'spec/helpers/tracking_helper_spec.rb',
- 'app/assets/javascripts/tracking/index.js',
- 'app/assets/javascripts/tracking/constants.js',
- 'app/assets/javascripts/tracking/get_standard_context.js',
- 'spec/frontend/tracking/get_standard_context_spec.js',
- 'spec/frontend/tracking_spec.js',
- 'generator_templates/usage_metric_definition/metric_definition.yml',
- 'lib/generators/gitlab/usage_metric/usage_metric_generator.rb',
- 'lib/generators/gitlab/usage_metric_definition_generator.rb',
- 'lib/generators/gitlab/usage_metric_definition/redis_hll_generator.rb',
- 'spec/lib/generators/gitlab/usage_metric_generator_spec.rb',
- 'spec/lib/generators/gitlab/usage_metric_definition_generator_spec.rb',
- 'spec/lib/generators/gitlab/usage_metric_definition/redis_hll_generator_spec.rb',
- 'config/metrics/schema.json'
- ].freeze
-
def missing_labels
return [] if !helper.ci? || helper.mr_has_labels?('growth experiment')
@@ -38,43 +18,6 @@ module Tooling
labels
end
-
- def matching_changed_files
- tracking_changed_files = all_changed_files & TRACKING_FILES
- usage_data_changed_files = all_changed_files.grep(%r{(usage_data)})
-
- usage_data_changed_files + tracking_changed_files + metrics_changed_files + snowplow_changed_files
- end
-
- private
-
- def all_changed_files
- helper.all_changed_files
- end
-
- def metrics_changed_files
- all_changed_files.grep(%r{((ee/)?config/metrics/.*\.yml)})
- end
-
- def matching_files?(file, extension:, pattern:)
- return unless file.end_with?(extension)
-
- helper.changed_lines(file).grep(pattern).any?
- end
-
- def snowplow_changed_files
- js_patterns = Regexp.union(
- 'Tracking.event',
- /\btrack\(/,
- 'data-track-action'
- )
- all_changed_files.select do |file|
- matching_files?(file, extension: '.rb', pattern: %r{Gitlab::Tracking\.(event|enabled\?|options)$}) ||
- matching_files?(file, extension: '.js', pattern: js_patterns) ||
- matching_files?(file, extension: '.vue', pattern: js_patterns) ||
- matching_files?(file, extension: '.haml', pattern: %r{data: \{ track})
- end
- end
end
end
end
diff --git a/tooling/danger/project_helper.rb b/tooling/danger/project_helper.rb
index c552a75bba8..1eac7380b34 100644
--- a/tooling/danger/project_helper.rb
+++ b/tooling/danger/project_helper.rb
@@ -38,6 +38,8 @@ module Tooling
%r{\A((ee|jh)/)?config/feature_flags/} => :feature_flag,
+ %r{doc/api/usage_data.md} => [:product_intelligence],
+
%r{\Adoc/.*(\.(md|png|gif|jpg|yml))\z} => :docs,
%r{\A(CONTRIBUTING|LICENSE|MAINTENANCE|PHILOSOPHY|PROCESS|README)(\.md)?\z} => :docs,
%r{\Adata/whats_new/} => :docs,
@@ -100,6 +102,7 @@ module Tooling
%r{\A((ee|jh)/)?spec/support/shared_contexts/features/} => :test,
%r{\A((ee|jh)/)?spec/support/helpers/features/} => :test,
+ %r{\A((spec/)?lib/generators/gitlab/usage_metric_)} => [:product_intelligence],
%r{\A((ee|jh)/)?lib/gitlab/usage_data_counters/.*\.yml\z} => [:product_intelligence],
%r{\A((ee|jh)/)?config/metrics/((.*\.yml)|(schema\.json))\z} => [:product_intelligence],
%r{\A((ee|jh)/)?lib/gitlab/usage_data(_counters)?(/|\.rb)} => [:backend, :product_intelligence],
@@ -108,9 +111,16 @@ module Tooling
spec/lib/gitlab/tracking_spec\.rb |
app/helpers/tracking_helper\.rb |
spec/helpers/tracking_helper_spec\.rb |
+ (spec/)?lib/generators/gitlab/usage_metric_\S+ |
+ (spec/)?lib/generators/gitlab/usage_metric_definition/redis_hll_generator(_spec)?\.rb |
lib/generators/rails/usage_metric_definition_generator\.rb |
spec/lib/generators/usage_metric_definition_generator_spec\.rb |
generator_templates/usage_metric_definition/metric_definition\.yml)\z}x => [:backend, :product_intelligence],
+ %r{gitlab/usage_data(_spec)?\.rb} => [:product_intelligence],
+ [%r{\.haml\z}, %r{data: \{ track}] => [:product_intelligence],
+ [%r{\.(rb|haml)\z}, %r{Gitlab::Tracking\.(event|enabled\?|options)$}] => [:product_intelligence],
+ [%r{\.(vue|js)\z}, %r{(Tracking.event|/\btrack\(/|data-track-action)}] => [:product_intelligence],
+
%r{\A((ee|jh)/)?app/(?!assets|views)[^/]+} => :backend,
%r{\A((ee|jh)/)?(bin|config|generator_templates|lib|rubocop)/} => :backend,
%r{\A((ee|jh)/)?spec/migrations} => :database,