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
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-28 21:14:03 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-28 21:14:03 +0300
commite804afddbf68cc6f306bc4aa9aaea88be774ebe4 (patch)
tree0ecb2ebf35e16b866b16da375920eb58f6353ef7 /lib
parent8188ca655a7437381491e565406869c747c1b40a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/system_hooks.rb12
-rw-r--r--lib/gitlab/auth/auth_finders.rb1
-rw-r--r--lib/gitlab/auth/o_auth/auth_hash.rb1
-rw-r--r--lib/gitlab/checks/base_bulk_checker.rb1
-rw-r--r--lib/gitlab/checks/base_single_checker.rb1
-rw-r--r--lib/gitlab/ci/pipeline/logger.rb1
-rw-r--r--lib/gitlab/ci/trace/remote_checksum.rb1
-rw-r--r--lib/gitlab/ci/variables/builder.rb1
-rw-r--r--lib/gitlab/database/count/exact_count_strategy.rb1
-rw-r--r--lib/gitlab/database/count/reltuples_count_strategy.rb1
-rw-r--r--lib/gitlab/database/partitioning/partition_manager.rb1
-rw-r--r--lib/gitlab/database/partitioning/replace_table.rb1
-rw-r--r--lib/gitlab/email/html_parser.rb1
-rw-r--r--lib/gitlab/git/blame.rb1
-rw-r--r--lib/gitlab/graphql/batch_key.rb1
-rw-r--r--lib/gitlab/insecure_key_fingerprint.rb1
-rw-r--r--lib/gitlab/json_cache.rb20
-rw-r--r--lib/gitlab/pagination/gitaly_keyset_pager.rb1
-rw-r--r--lib/gitlab/pagination/keyset/cursor_based_request_context.rb1
-rw-r--r--lib/gitlab/pagination/keyset/header_builder.rb1
-rw-r--r--lib/gitlab/pagination/offset_pagination.rb1
-rw-r--r--lib/gitlab/prometheus/queries/base_query.rb1
-rw-r--r--lib/gitlab/usage/metrics/instrumentations/cert_based_clusters_ff_metric.rb15
-rw-r--r--lib/gitlab/usage_data.rb3
-rw-r--r--lib/sidebars/menu.rb1
25 files changed, 62 insertions, 9 deletions
diff --git a/lib/api/system_hooks.rb b/lib/api/system_hooks.rb
index e4133713c1f..7c91fbd36d9 100644
--- a/lib/api/system_hooks.rb
+++ b/lib/api/system_hooks.rb
@@ -22,6 +22,18 @@ module API
present paginate(SystemHook.all), with: Entities::Hook
end
+ desc 'Get a hook' do
+ success Entities::Hook
+ end
+ params do
+ requires :id, type: Integer, desc: 'The ID of the system hook'
+ end
+ get ":id" do
+ hook = SystemHook.find(params[:id])
+
+ present hook, with: Entities::Hook
+ end
+
desc 'Create a new system hook' do
success Entities::Hook
end
diff --git a/lib/gitlab/auth/auth_finders.rb b/lib/gitlab/auth/auth_finders.rb
index ecda96af403..7adaaef86e4 100644
--- a/lib/gitlab/auth/auth_finders.rb
+++ b/lib/gitlab/auth/auth_finders.rb
@@ -12,6 +12,7 @@ module Gitlab
class InsufficientScopeError < AuthenticationError
attr_reader :scopes
+
def initialize(scopes)
@scopes = scopes.map { |s| s.try(:name) || s }
end
diff --git a/lib/gitlab/auth/o_auth/auth_hash.rb b/lib/gitlab/auth/o_auth/auth_hash.rb
index 2ec75669d24..a45778159c7 100644
--- a/lib/gitlab/auth/o_auth/auth_hash.rb
+++ b/lib/gitlab/auth/o_auth/auth_hash.rb
@@ -7,6 +7,7 @@ module Gitlab
module OAuth
class AuthHash
attr_reader :auth_hash
+
def initialize(auth_hash)
@auth_hash = auth_hash
end
diff --git a/lib/gitlab/checks/base_bulk_checker.rb b/lib/gitlab/checks/base_bulk_checker.rb
index 46a68fdf485..e2a016a9907 100644
--- a/lib/gitlab/checks/base_bulk_checker.rb
+++ b/lib/gitlab/checks/base_bulk_checker.rb
@@ -4,6 +4,7 @@ module Gitlab
module Checks
class BaseBulkChecker < BaseChecker
attr_reader :changes_access
+
delegate(*ChangesAccess::ATTRIBUTES, to: :changes_access)
def initialize(changes_access)
diff --git a/lib/gitlab/checks/base_single_checker.rb b/lib/gitlab/checks/base_single_checker.rb
index 06519833d7c..435f4ccf5ba 100644
--- a/lib/gitlab/checks/base_single_checker.rb
+++ b/lib/gitlab/checks/base_single_checker.rb
@@ -4,6 +4,7 @@ module Gitlab
module Checks
class BaseSingleChecker < BaseChecker
attr_reader :change_access
+
delegate(*SingleChangeAccess::ATTRIBUTES, to: :change_access)
def initialize(change_access)
diff --git a/lib/gitlab/ci/pipeline/logger.rb b/lib/gitlab/ci/pipeline/logger.rb
index 10c0fe295f8..ee6c3898592 100644
--- a/lib/gitlab/ci/pipeline/logger.rb
+++ b/lib/gitlab/ci/pipeline/logger.rb
@@ -94,6 +94,7 @@ module Gitlab
private
attr_reader :project, :destination, :started_at, :log_conditions
+
delegate :current_monotonic_time, to: :class
def age
diff --git a/lib/gitlab/ci/trace/remote_checksum.rb b/lib/gitlab/ci/trace/remote_checksum.rb
index 7f43d91e6d7..eaa9be9dd15 100644
--- a/lib/gitlab/ci/trace/remote_checksum.rb
+++ b/lib/gitlab/ci/trace/remote_checksum.rb
@@ -23,6 +23,7 @@ module Gitlab
private
attr_reader :trace_artifact
+
delegate :aws?, :google?, to: :object_store_config, prefix: :provider
def fetch_md5_checksum
diff --git a/lib/gitlab/ci/variables/builder.rb b/lib/gitlab/ci/variables/builder.rb
index ec2ec3396ea..a51abe9f8de 100644
--- a/lib/gitlab/ci/variables/builder.rb
+++ b/lib/gitlab/ci/variables/builder.rb
@@ -96,6 +96,7 @@ module Gitlab
attr_reader :instance_variables_builder
attr_reader :project_variables_builder
attr_reader :group_variables_builder
+
delegate :project, to: :pipeline
def predefined_variables(job)
diff --git a/lib/gitlab/database/count/exact_count_strategy.rb b/lib/gitlab/database/count/exact_count_strategy.rb
index 0b8fe640bf8..345c7e44b05 100644
--- a/lib/gitlab/database/count/exact_count_strategy.rb
+++ b/lib/gitlab/database/count/exact_count_strategy.rb
@@ -12,6 +12,7 @@ module Gitlab
# Note that for very large tables, this may even timeout.
class ExactCountStrategy
attr_reader :models
+
def initialize(models)
@models = models
end
diff --git a/lib/gitlab/database/count/reltuples_count_strategy.rb b/lib/gitlab/database/count/reltuples_count_strategy.rb
index f60ead26b03..0f89c500688 100644
--- a/lib/gitlab/database/count/reltuples_count_strategy.rb
+++ b/lib/gitlab/database/count/reltuples_count_strategy.rb
@@ -14,6 +14,7 @@ module Gitlab
# however is guaranteed to be "fast", because it only looks up statistics.
class ReltuplesCountStrategy
attr_reader :models
+
def initialize(models)
@models = models
end
diff --git a/lib/gitlab/database/partitioning/partition_manager.rb b/lib/gitlab/database/partitioning/partition_manager.rb
index ab414f91169..3ee9a193b45 100644
--- a/lib/gitlab/database/partitioning/partition_manager.rb
+++ b/lib/gitlab/database/partitioning/partition_manager.rb
@@ -46,6 +46,7 @@ module Gitlab
private
attr_reader :model
+
delegate :connection, to: :model
def missing_partitions
diff --git a/lib/gitlab/database/partitioning/replace_table.rb b/lib/gitlab/database/partitioning/replace_table.rb
index a7686e97553..21a175a660d 100644
--- a/lib/gitlab/database/partitioning/replace_table.rb
+++ b/lib/gitlab/database/partitioning/replace_table.rb
@@ -31,6 +31,7 @@ module Gitlab
private
attr_reader :connection
+
delegate :execute, :quote_table_name, :quote_column_name, to: :connection
def default_sequence(table, column)
diff --git a/lib/gitlab/email/html_parser.rb b/lib/gitlab/email/html_parser.rb
index 77f299bcade..27ba5d2a314 100644
--- a/lib/gitlab/email/html_parser.rb
+++ b/lib/gitlab/email/html_parser.rb
@@ -8,6 +8,7 @@ module Gitlab
end
attr_reader :raw_body
+
def initialize(raw_body)
@raw_body = raw_body
end
diff --git a/lib/gitlab/git/blame.rb b/lib/gitlab/git/blame.rb
index a5b1b7d914b..5669a65cbd9 100644
--- a/lib/gitlab/git/blame.rb
+++ b/lib/gitlab/git/blame.rb
@@ -63,6 +63,7 @@ module Gitlab
class BlameLine
attr_accessor :lineno, :oldlineno, :commit, :line
+
def initialize(lineno, oldlineno, commit, line)
@lineno = lineno
@oldlineno = oldlineno
diff --git a/lib/gitlab/graphql/batch_key.rb b/lib/gitlab/graphql/batch_key.rb
index 51203af5a43..553e0573c63 100644
--- a/lib/gitlab/graphql/batch_key.rb
+++ b/lib/gitlab/graphql/batch_key.rb
@@ -4,6 +4,7 @@ module Gitlab
module Graphql
class BatchKey
attr_reader :object
+
delegate :hash, to: :object
def initialize(object, lookahead = nil, object_name: nil)
diff --git a/lib/gitlab/insecure_key_fingerprint.rb b/lib/gitlab/insecure_key_fingerprint.rb
index 7b1cf5e7931..ef342f3819f 100644
--- a/lib/gitlab/insecure_key_fingerprint.rb
+++ b/lib/gitlab/insecure_key_fingerprint.rb
@@ -10,6 +10,7 @@ module Gitlab
#
class InsecureKeyFingerprint
attr_accessor :key
+
alias_attribute :fingerprint_md5, :fingerprint
#
diff --git a/lib/gitlab/json_cache.rb b/lib/gitlab/json_cache.rb
index 41c18f82a4b..d2916a01809 100644
--- a/lib/gitlab/json_cache.rb
+++ b/lib/gitlab/json_cache.rb
@@ -2,12 +2,17 @@
module Gitlab
class JsonCache
- attr_reader :backend, :cache_key_with_version, :namespace
+ attr_reader :backend, :namespace
+
+ STRATEGY_KEY_COMPONENTS = {
+ revision: Gitlab.revision,
+ version: [Gitlab::VERSION, Rails.version]
+ }.freeze
def initialize(options = {})
@backend = options.fetch(:backend, Rails.cache)
@namespace = options.fetch(:namespace, nil)
- @cache_key_with_version = options.fetch(:cache_key_with_version, true)
+ @cache_key_strategy = options.fetch(:cache_key_strategy, :revision)
end
def active?
@@ -19,13 +24,12 @@ module Gitlab
end
def cache_key(key)
- expanded_cache_key = [namespace, key].compact
-
- if cache_key_with_version
- expanded_cache_key << [Gitlab::VERSION, Rails.version]
- end
+ expanded_cache_key = [namespace, key, *strategy_key_component].compact
+ expanded_cache_key.join(':').freeze
+ end
- expanded_cache_key.flatten.join(':').freeze
+ def strategy_key_component
+ STRATEGY_KEY_COMPONENTS.fetch(@cache_key_strategy)
end
def expire(key)
diff --git a/lib/gitlab/pagination/gitaly_keyset_pager.rb b/lib/gitlab/pagination/gitaly_keyset_pager.rb
index 99a3145104a..e76cab688cc 100644
--- a/lib/gitlab/pagination/gitaly_keyset_pager.rb
+++ b/lib/gitlab/pagination/gitaly_keyset_pager.rb
@@ -4,6 +4,7 @@ module Gitlab
module Pagination
class GitalyKeysetPager
attr_reader :request_context, :project
+
delegate :params, to: :request_context
def initialize(request_context, project)
diff --git a/lib/gitlab/pagination/keyset/cursor_based_request_context.rb b/lib/gitlab/pagination/keyset/cursor_based_request_context.rb
index 18390f5b59d..e06d7e48ca3 100644
--- a/lib/gitlab/pagination/keyset/cursor_based_request_context.rb
+++ b/lib/gitlab/pagination/keyset/cursor_based_request_context.rb
@@ -6,6 +6,7 @@ module Gitlab
class CursorBasedRequestContext
DEFAULT_SORT_DIRECTION = :desc
attr_reader :request_context
+
delegate :params, to: :request_context
def initialize(request_context)
diff --git a/lib/gitlab/pagination/keyset/header_builder.rb b/lib/gitlab/pagination/keyset/header_builder.rb
index 888d93d5fe3..1036916e665 100644
--- a/lib/gitlab/pagination/keyset/header_builder.rb
+++ b/lib/gitlab/pagination/keyset/header_builder.rb
@@ -5,6 +5,7 @@ module Gitlab
module Keyset
class HeaderBuilder
attr_reader :request_context
+
delegate :params, :header, :request, to: :request_context
def initialize(request_context)
diff --git a/lib/gitlab/pagination/offset_pagination.rb b/lib/gitlab/pagination/offset_pagination.rb
index 4f8a6ffb2cc..8cb959769ee 100644
--- a/lib/gitlab/pagination/offset_pagination.rb
+++ b/lib/gitlab/pagination/offset_pagination.rb
@@ -4,6 +4,7 @@ module Gitlab
module Pagination
class OffsetPagination < Base
attr_reader :request_context
+
delegate :params, :header, :request, to: :request_context
def initialize(request_context)
diff --git a/lib/gitlab/prometheus/queries/base_query.rb b/lib/gitlab/prometheus/queries/base_query.rb
index 9ff414d5236..eabac6128b5 100644
--- a/lib/gitlab/prometheus/queries/base_query.rb
+++ b/lib/gitlab/prometheus/queries/base_query.rb
@@ -5,6 +5,7 @@ module Gitlab
module Queries
class BaseQuery
attr_accessor :client
+
delegate :query_range, :query, :label_values, :series, to: :client, prefix: true
def raw_memory_usage_query(environment_slug)
diff --git a/lib/gitlab/usage/metrics/instrumentations/cert_based_clusters_ff_metric.rb b/lib/gitlab/usage/metrics/instrumentations/cert_based_clusters_ff_metric.rb
new file mode 100644
index 00000000000..6df6fef5d3a
--- /dev/null
+++ b/lib/gitlab/usage/metrics/instrumentations/cert_based_clusters_ff_metric.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Usage
+ module Metrics
+ module Instrumentations
+ class CertBasedClustersFfMetric < GenericMetric
+ value do
+ Feature.enabled?(:certificate_based_clusters, default_enabled: :yaml, type: :ops)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb
index 1250d3fd562..951ec5ea5c3 100644
--- a/lib/gitlab/usage_data.rb
+++ b/lib/gitlab/usage_data.rb
@@ -224,7 +224,8 @@ module Gitlab
collected_data_categories: add_metric('CollectedDataCategoriesMetric', time_frame: 'none'),
service_ping_features_enabled: add_metric('ServicePingFeaturesMetric', time_frame: 'none'),
snowplow_enabled: add_metric('SnowplowEnabledMetric', time_frame: 'none'),
- snowplow_configured_to_gitlab_collector: add_metric('SnowplowConfiguredToGitlabCollectorMetric', time_frame: 'none')
+ snowplow_configured_to_gitlab_collector: add_metric('SnowplowConfiguredToGitlabCollectorMetric', time_frame: 'none'),
+ certificate_based_clusters_ff: add_metric('CertBasedClustersFfMetric')
}
}
end
diff --git a/lib/sidebars/menu.rb b/lib/sidebars/menu.rb
index 1af3d024291..d9d294ff982 100644
--- a/lib/sidebars/menu.rb
+++ b/lib/sidebars/menu.rb
@@ -15,6 +15,7 @@ module Sidebars
include ::Sidebars::Concerns::HasPartial
attr_reader :context
+
delegate :current_user, :container, to: :@context
def initialize(context)