diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /tooling/danger | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'tooling/danger')
-rw-r--r-- | tooling/danger/changelog.rb | 6 | ||||
-rw-r--r-- | tooling/danger/product_intelligence.rb | 19 | ||||
-rw-r--r-- | tooling/danger/project_helper.rb | 29 |
3 files changed, 23 insertions, 31 deletions
diff --git a/tooling/danger/changelog.rb b/tooling/danger/changelog.rb index fbf8ae931e2..6a392afac13 100644 --- a/tooling/danger/changelog.rb +++ b/tooling/danger/changelog.rb @@ -159,8 +159,8 @@ module Tooling def required_reasons [].tap do |reasons| - reasons << :db_changes if project_helper.changes.added.has_category?(:migration) - reasons << :feature_flag_removed if project_helper.changes.deleted.has_category?(:feature_flag) + reasons << :db_changes if helper.changes.added.has_category?(:migration) + reasons << :feature_flag_removed if helper.changes.deleted.has_category?(:feature_flag) end end @@ -221,7 +221,7 @@ module Tooling end def categories_need_changelog? - (project_helper.changes.categories - NO_CHANGELOG_CATEGORIES).any? + (helper.changes.categories - NO_CHANGELOG_CATEGORIES).any? end def mr_without_no_changelog_label? diff --git a/tooling/danger/product_intelligence.rb b/tooling/danger/product_intelligence.rb index 72fc8deac43..6185b2f0d08 100644 --- a/tooling/danger/product_intelligence.rb +++ b/tooling/danger/product_intelligence.rb @@ -4,21 +4,32 @@ module Tooling module Danger module ProductIntelligence + APPROVED_LABEL = 'product intelligence::approved' + REVIEW_LABEL = 'product intelligence::review pending' + WORKFLOW_LABELS = [ - 'product intelligence::approved', - 'product intelligence::review pending' + APPROVED_LABEL, + REVIEW_LABEL ].freeze def missing_labels - return [] if !helper.ci? || helper.mr_has_labels?('growth experiment') + return [] unless helper.ci? labels = [] labels << 'product intelligence' unless helper.mr_has_labels?('product intelligence') - labels << 'product intelligence::review pending' unless has_workflow_labels? + labels << REVIEW_LABEL unless has_workflow_labels? labels end + def has_approved_label? + helper.mr_labels.include?(APPROVED_LABEL) + end + + def skip_review? + helper.mr_has_labels?('growth experiment') + end + private def has_workflow_labels? diff --git a/tooling/danger/project_helper.rb b/tooling/danger/project_helper.rb index 5d338393f90..b49df50c5f0 100644 --- a/tooling/danger/project_helper.rb +++ b/tooling/danger/project_helper.rb @@ -5,6 +5,7 @@ module Tooling module ProjectHelper LOCAL_RULES ||= %w[ changelog + ci_config database documentation duplicate_yarn_dependencies @@ -127,7 +128,7 @@ module Tooling %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)/)?config/(events|metrics)/((.*\.yml)|(schema\.json))\z} => [:product_intelligence], %r{\A((ee|jh)/)?lib/gitlab/usage_data(_counters)?(/|\.rb)} => [:backend, :product_intelligence], %r{\A( lib/gitlab/tracking\.rb | @@ -151,7 +152,8 @@ module Tooling %r{\A((ee|jh)/)?vendor/} => :backend, %r{\A(Gemfile|Gemfile.lock|Rakefile)\z} => :backend, %r{\A[A-Z_]+_VERSION\z} => :backend, - %r{\A\.rubocop((_manual)?_todo)?\.yml\z} => :backend, + %r{\A\.rubocop(_todo)?\.yml\z} => :backend, + %r{\A\.rubocop_todo/.*\.yml\z} => :backend, %r{\Afile_hooks/} => :backend, %r{\A((ee|jh)/)?qa/} => :qa, @@ -174,18 +176,6 @@ module Tooling %r{\.js\z} => :frontend }.freeze - def changes_by_category - helper.changes_by_category(CATEGORIES) - end - - def changes - helper.changes(CATEGORIES) - end - - def categories_for_file(file) - helper.categories_for_file(file, CATEGORIES) - end - def local_warning_message "#{MESSAGE_PREFIX} Only the following Danger rules can be run locally: #{LOCAL_RULES.join(', ')}" end @@ -201,11 +191,7 @@ module Tooling end def all_ee_changes - changes.files.grep(%r{\Aee/}) - end - - def project_name - ee? ? 'gitlab' : 'gitlab-foss' + helper.changes.files.grep(%r{\Aee/}) end def file_lines(filename) @@ -221,11 +207,6 @@ module Tooling def read_file(filename) File.read(filename) end - - def ee? - # Support former project name for `dev` and support local Danger run - %w[gitlab gitlab-ee].include?(ENV['CI_PROJECT_NAME']) || Dir.exist?(File.expand_path('../../ee', __dir__)) - end end end end |