summaryrefslogtreecommitdiff
path: root/lib/gitlab
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/danger/changelog.rb10
-rw-r--r--lib/gitlab/danger/helper.rb4
-rw-r--r--lib/gitlab/file_detector.rb2
-rw-r--r--lib/gitlab/metrics/dashboard/finder.rb2
-rw-r--r--lib/gitlab/metrics/dashboard/service_selector.rb2
-rw-r--r--lib/gitlab/sidekiq_middleware/duplicate_jobs.rb14
-rw-r--r--lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb2
7 files changed, 23 insertions, 13 deletions
diff --git a/lib/gitlab/danger/changelog.rb b/lib/gitlab/danger/changelog.rb
index b53516081be..d64177f9565 100644
--- a/lib/gitlab/danger/changelog.rb
+++ b/lib/gitlab/danger/changelog.rb
@@ -11,7 +11,7 @@ module Gitlab
end
def found
- git.added_files.find { |path| path =~ %r{\A(ee/)?(changelogs/unreleased)(-ee)?/} }
+ @found ||= git.added_files.find { |path| path =~ %r{\A(ee/)?(changelogs/unreleased)(-ee)?/} }
end
def presented_no_changelog_labels
@@ -22,12 +22,8 @@ module Gitlab
gitlab.mr_json["title"].gsub(/^WIP: */, '').gsub(/`/, '\\\`')
end
- def ee_changelog?(changelog_path)
- changelog_path =~ /unreleased-ee/
- end
-
- def ce_port_changelog?(changelog_path)
- helper.ee? && !ee_changelog?(changelog_path)
+ def ee_changelog?
+ found.start_with?('ee/')
end
private
diff --git a/lib/gitlab/danger/helper.rb b/lib/gitlab/danger/helper.rb
index 77a84634815..6bb46b1730f 100644
--- a/lib/gitlab/danger/helper.rb
+++ b/lib/gitlab/danger/helper.rb
@@ -34,6 +34,10 @@ module Gitlab
.sort
end
+ def all_ee_changes
+ all_changed_files.grep(%r{\Aee/})
+ 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?('../../ee')
diff --git a/lib/gitlab/file_detector.rb b/lib/gitlab/file_detector.rb
index 305fbeecce1..a9e9261cd3c 100644
--- a/lib/gitlab/file_detector.rb
+++ b/lib/gitlab/file_detector.rb
@@ -40,7 +40,7 @@ module Gitlab
yarn_lock: 'yarn.lock',
# OpenAPI Specification files
- openapi: %r{.*(openapi|swagger).*\.(yaml|yml|json)\z}i
+ openapi: %r{[^/]*(openapi|swagger)[^/]*\.(yaml|yml|json)\z}i
}.freeze
# Returns an Array of file types based on the given paths.
diff --git a/lib/gitlab/metrics/dashboard/finder.rb b/lib/gitlab/metrics/dashboard/finder.rb
index 990fd57bf41..d80985e0a0e 100644
--- a/lib/gitlab/metrics/dashboard/finder.rb
+++ b/lib/gitlab/metrics/dashboard/finder.rb
@@ -78,7 +78,7 @@ module Gitlab
end
def project_service
- ::Metrics::Dashboard::ProjectDashboardService
+ ::Metrics::Dashboard::CustomDashboardService
end
def self_monitoring_service
diff --git a/lib/gitlab/metrics/dashboard/service_selector.rb b/lib/gitlab/metrics/dashboard/service_selector.rb
index 993e508cbc6..281538de502 100644
--- a/lib/gitlab/metrics/dashboard/service_selector.rb
+++ b/lib/gitlab/metrics/dashboard/service_selector.rb
@@ -20,7 +20,7 @@ module Gitlab
::Metrics::Dashboard::SystemDashboardService,
::Metrics::Dashboard::PodDashboardService,
::Metrics::Dashboard::SelfMonitoringDashboardService,
- ::Metrics::Dashboard::ProjectDashboardService
+ ::Metrics::Dashboard::CustomDashboardService
].freeze
# Returns a class which inherits from the BaseService
diff --git a/lib/gitlab/sidekiq_middleware/duplicate_jobs.rb b/lib/gitlab/sidekiq_middleware/duplicate_jobs.rb
index 23222430902..f0e26f99c2c 100644
--- a/lib/gitlab/sidekiq_middleware/duplicate_jobs.rb
+++ b/lib/gitlab/sidekiq_middleware/duplicate_jobs.rb
@@ -5,8 +5,18 @@ require 'digest'
module Gitlab
module SidekiqMiddleware
module DuplicateJobs
- def self.drop_duplicates?
- Feature.enabled?(:drop_duplicate_sidekiq_jobs)
+ DROPPABLE_QUEUES = Set.new([
+ Namespaces::RootStatisticsWorker.queue
+ ]).freeze
+
+ def self.drop_duplicates?(queue_name)
+ Feature.enabled?(:drop_duplicate_sidekiq_jobs) ||
+ drop_duplicates_for_queue?(queue_name)
+ end
+
+ private_class_method def self.drop_duplicates_for_queue?(queue_name)
+ DROPPABLE_QUEUES.include?(queue_name) &&
+ Feature.enabled?(:drop_duplicate_sidekiq_jobs_for_queue)
end
end
end
diff --git a/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb b/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb
index c6fb50b4610..a9007039334 100644
--- a/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb
+++ b/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb
@@ -67,7 +67,7 @@ module Gitlab
end
def droppable?
- idempotent? && duplicate? && DuplicateJobs.drop_duplicates?
+ idempotent? && duplicate? && DuplicateJobs.drop_duplicates?(queue_name)
end
private