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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-10-31 18:12:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-31 18:12:11 +0300
commit47bf4294773cf15aa755193cdd7df9a491a49f52 (patch)
tree350f2f90dbada489abd74a6693e8640890ab96b5 /lib/gitlab
parentf52f8542b47c9e00ddf420abaf2263de168988f9 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/checks/diff_check.rb3
-rw-r--r--lib/gitlab/usage/metric_definition.rb23
2 files changed, 20 insertions, 6 deletions
diff --git a/lib/gitlab/checks/diff_check.rb b/lib/gitlab/checks/diff_check.rb
index 15b38188f13..a359236e150 100644
--- a/lib/gitlab/checks/diff_check.rb
+++ b/lib/gitlab/checks/diff_check.rb
@@ -31,8 +31,7 @@ module Gitlab
def treeish_objects
objects = commits
- return objects unless project.repository.empty? &&
- Feature.enabled?(:verify_push_rules_for_first_commit, project)
+ return objects unless project.repository.empty?
# It's a special case for the push to the empty repository
#
diff --git a/lib/gitlab/usage/metric_definition.rb b/lib/gitlab/usage/metric_definition.rb
index 7252283d1b9..941c2f793c4 100644
--- a/lib/gitlab/usage/metric_definition.rb
+++ b/lib/gitlab/usage/metric_definition.rb
@@ -3,7 +3,7 @@
module Gitlab
module Usage
class MetricDefinition
- METRIC_SCHEMA_PATH = Rails.root.join('config', 'metrics', 'schema.json')
+ METRIC_SCHEMA_PATH = Rails.root.join('config', 'metrics', 'schema', '**', '*.json')
AVAILABLE_STATUSES = %w[active broken].to_set.freeze
VALID_SERVICE_PING_STATUSES = %w[active broken].to_set.freeze
@@ -52,7 +52,7 @@ module Gitlab
end
def validate!
- self.class.schemer.validate(attributes.deep_stringify_keys).each do |error|
+ errors.each do |error|
error_message = <<~ERROR_MSG
Error type: #{error['type']}
Data: #{error['data']}
@@ -104,8 +104,10 @@ module Gitlab
definitions[key_path]&.to_context
end
- def schemer
- @schemer ||= ::JSONSchemer.schema(Pathname.new(METRIC_SCHEMA_PATH))
+ def schemers
+ @schemers ||= Dir[METRIC_SCHEMA_PATH].map do |path|
+ ::JSONSchemer.schema(Pathname.new(path))
+ end
end
def dump_metrics_yaml
@@ -145,6 +147,19 @@ module Gitlab
private
+ def errors
+ result = []
+
+ self.class.schemers.each do |schemer|
+ # schemer.validate returns an Enumerator object
+ schemer.validate(attributes.deep_stringify_keys).each do |error|
+ result << error
+ end
+ end
+
+ result
+ end
+
def method_missing(method, *args)
attributes[method] || super
end