diff options
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/0_marginalia.rb | 7 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 8 | ||||
-rw-r--r-- | config/initializers/doorkeeper.rb | 14 | ||||
-rw-r--r-- | config/initializers/doorkeeper_openid_connect.rb | 7 | ||||
-rw-r--r-- | config/initializers/gitlab_suggested_reviewers_secret.rb | 5 | ||||
-rw-r--r-- | config/initializers/grape_validators.rb | 3 | ||||
-rw-r--r-- | config/initializers/rspec_profiling.rb | 29 |
7 files changed, 67 insertions, 6 deletions
diff --git a/config/initializers/0_marginalia.rb b/config/initializers/0_marginalia.rb index c776747939f..e0e68ce7248 100644 --- a/config/initializers/0_marginalia.rb +++ b/config/initializers/0_marginalia.rb @@ -24,7 +24,12 @@ if Gitlab.dev_or_test_env? Marginalia::Comment.components << :line Marginalia::Comment.lines_to_ignore = Regexp.union( Gitlab::BacktraceCleaner::IGNORE_BACKTRACES + %w[ - lib/ruby/gems/ lib/gem_extensions/ lib/ruby/ lib/gitlab/marginalia/ gems/ + lib/ruby/gems/ + lib/gem_extensions/ + lib/ruby/ + lib/gitlab/marginalia/ + gems/ + lib/gitlab/database/load_balancing/connection_proxy.rb ]) end diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index aafca0e2f09..55c21744ad0 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -870,6 +870,14 @@ Settings.gitlab_kas['internal_url'] ||= 'grpc://localhost:8153' # Settings.gitlab_kas['external_k8s_proxy_url'] ||= 'grpc://localhost:8154' # NOTE: Do not set a default until all distributions have been updated with a correct value # +# Suggested Reviewers +# +Gitlab.ee do + Settings['suggested_reviewers'] ||= Settingslogic.new({}) + Settings.suggested_reviewers['secret_file'] ||= Rails.root.join('.gitlab_suggested_reviewers_secret') +end + +# # Repositories # Settings['repositories'] ||= Settingslogic.new({}) diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index 918b2767c4d..d24c5431f53 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -121,3 +121,17 @@ Doorkeeper.configure do # We might want to disable this in the future, see https://gitlab.com/gitlab-org/gitlab/-/issues/323615 skip_client_authentication_for_password_grant true end + +module Doorkeeper + class AccessToken + # Doorkeeper OAuth Token refresh uses expires_in of refresh token for new token + # https://github.com/doorkeeper-gem/doorkeeper/pull/1366 + # This override ensures that tokens with expires_in: nil do not create new + # tokens with expires_in: nil during refresh flow. + # Can be removed after https://gitlab.com/gitlab-org/gitlab/-/issues/386094 is + # closed + def expires_in + super || 2.hours + end + end +end diff --git a/config/initializers/doorkeeper_openid_connect.rb b/config/initializers/doorkeeper_openid_connect.rb index b2cb1843fab..a3a2550811b 100644 --- a/config/initializers/doorkeeper_openid_connect.rb +++ b/config/initializers/doorkeeper_openid_connect.rb @@ -31,8 +31,9 @@ Doorkeeper::OpenidConnect.configure do Digest::SHA256.hexdigest "#{user.id}-#{Rails.application.secrets.secret_key_base}" end - o.claim(:name) { |user| user.name } - o.claim(:nickname) { |user| user.username } + o.claim(:name) { |user| user.name } + o.claim(:nickname) { |user| user.username } + o.claim(:preferred_username) { |user| user.username } # Check whether the application has access to the email scope, and grant # access to the user's primary email address if so, otherwise their @@ -54,7 +55,7 @@ Doorkeeper::OpenidConnect.configure do end end - o.claim(:website) { |user| user.full_website_url if user.website_url? } + o.claim(:website) { |user| user.full_website_url if user.website_url.present? } o.claim(:profile) { |user| Gitlab::Routing.url_helpers.user_url user } o.claim(:picture) { |user| user.avatar_url(only_path: false) } o.claim(:groups) { |user| user.membership_groups.joins(:route).with_route.map(&:full_path) } diff --git a/config/initializers/gitlab_suggested_reviewers_secret.rb b/config/initializers/gitlab_suggested_reviewers_secret.rb new file mode 100644 index 00000000000..01c7299c414 --- /dev/null +++ b/config/initializers/gitlab_suggested_reviewers_secret.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +return unless Gitlab.com? && Gitlab.ee? + +Gitlab::AppliedMl::SuggestedReviewers.ensure_secret! diff --git a/config/initializers/grape_validators.rb b/config/initializers/grape_validators.rb index 1492894e1fa..1eaceddf531 100644 --- a/config/initializers/grape_validators.rb +++ b/config/initializers/grape_validators.rb @@ -11,3 +11,6 @@ Grape::Validations.register_validator(:untrusted_regexp, ::API::Validations::Val Grape::Validations.register_validator(:email_or_email_list, ::API::Validations::Validators::EmailOrEmailList) Grape::Validations.register_validator(:iteration_id, ::API::Validations::Validators::IntegerOrCustomValue) Grape::Validations.register_validator(:project_portable, ::API::Validations::Validators::ProjectPortable) +Grape::Validations.register_validator(:destination_namespace_path, ::API::Validations::Validators::BulkImports::DestinationNamespacePath) # rubocop: disable Layout/LineLength +Grape::Validations.register_validator(:destination_slug_path, ::API::Validations::Validators::BulkImports::DestinationSlugPath) # rubocop: disable Layout/LineLength +Grape::Validations.register_validator(:source_full_path, ::API::Validations::Validators::BulkImports::SourceFullPath) diff --git a/config/initializers/rspec_profiling.rb b/config/initializers/rspec_profiling.rb index 2ab7bdade31..7cc2d6afb0f 100644 --- a/config/initializers/rspec_profiling.rb +++ b/config/initializers/rspec_profiling.rb @@ -6,7 +6,8 @@ module RspecProfilingExt module Collectors class CSVWithTimestamps < ::RspecProfiling::Collectors::CSV TIMESTAMP_FIELDS = %w(created_at updated_at).freeze - HEADERS = (::RspecProfiling::Collectors::CSV::HEADERS + TIMESTAMP_FIELDS).freeze + METADATA_FIELDS = %w(feature_category).freeze + HEADERS = (::RspecProfiling::Collectors::CSV::HEADERS + TIMESTAMP_FIELDS + METADATA_FIELDS).freeze def insert(attributes) output << HEADERS.map do |field| @@ -40,9 +41,32 @@ module RspecProfilingExt end end + module Example + def feature_category + metadata[:feature_category] + end + end + module Run def example_finished(*args) - super + # rubocop:disable Gitlab/ModuleWithInstanceVariables + collector.insert({ + branch: vcs.branch, + commit_hash: vcs.sha, + date: vcs.time, + file: @current_example.file, + line_number: @current_example.line_number, + description: @current_example.description, + status: @current_example.status, + exception: @current_example.exception, + time: @current_example.time, + query_count: @current_example.query_count, + query_time: @current_example.query_time, + request_count: @current_example.request_count, + request_time: @current_example.request_time, + feature_category: @current_example.feature_category + }) + # rubocop:enable Gitlab/ModuleWithInstanceVariables rescue StandardError => err return if @already_logged_example_finished_error # rubocop:disable Gitlab/ModuleWithInstanceVariables @@ -59,6 +83,7 @@ RspecProfiling.configure do |config| if ENV.key?('CI') || ENV.key?('RSPEC_PROFILING') RspecProfiling::VCS::Git.prepend(RspecProfilingExt::Git) RspecProfiling::Run.prepend(RspecProfilingExt::Run) + RspecProfiling::Example.prepend(RspecProfilingExt::Example) config.collector = RspecProfilingExt::Collectors::CSVWithTimestamps config.csv_path = -> do prefix = "#{ENV['CI_JOB_NAME']}-".gsub(%r{[ /]}, '-') if ENV['CI_JOB_NAME'] |