diff options
| -rw-r--r-- | GITLAB_PAGES_VERSION | 2 | ||||
| -rw-r--r-- | config/initializers/validate_database_config.rb | 6 | ||||
| -rw-r--r-- | lib/gitlab/patch/database_config.rb | 21 | ||||
| -rw-r--r-- | locale/gitlab.pot | 3 | ||||
| -rw-r--r-- | spec/initializers/validate_database_config_spec.rb | 40 | ||||
| -rw-r--r-- | spec/lib/gitlab/patch/database_config_spec.rb | 59 |
6 files changed, 16 insertions, 115 deletions
diff --git a/GITLAB_PAGES_VERSION b/GITLAB_PAGES_VERSION index 43c989b5531..373aea97570 100644 --- a/GITLAB_PAGES_VERSION +++ b/GITLAB_PAGES_VERSION @@ -1 +1 @@ -1.56.1 +1.57.0 diff --git a/config/initializers/validate_database_config.rb b/config/initializers/validate_database_config.rb index d5e73cdc1ee..d381dbac2ed 100644 --- a/config/initializers/validate_database_config.rb +++ b/config/initializers/validate_database_config.rb @@ -4,12 +4,6 @@ if Gitlab::Utils.to_boolean(ENV['SKIP_DATABASE_CONFIG_VALIDATION'], default: fal return end -if Rails.application.config.uses_legacy_database_config - warn "WARNING: This installation of GitLab uses a deprecated syntax for 'config/database.yml'. " \ - "The support for this syntax will be removed in 15.0. " \ - "More information can be found here: https://gitlab.com/gitlab-org/gitlab/-/issues/338182" -end - if configurations = ActiveRecord::Base.configurations.configurations if configurations.first.name != Gitlab::Database::MAIN_DATABASE_NAME raise "ERROR: This installation of GitLab uses unsupported 'config/database.yml'. " \ diff --git a/lib/gitlab/patch/database_config.rb b/lib/gitlab/patch/database_config.rb index 702e8d404b1..c5c73d50518 100644 --- a/lib/gitlab/patch/database_config.rb +++ b/lib/gitlab/patch/database_config.rb @@ -31,10 +31,6 @@ module Gitlab module DatabaseConfig extend ActiveSupport::Concern - prepended do - attr_reader :uses_legacy_database_config - end - def load_database_yaml return super unless Gitlab.ee? @@ -70,24 +66,7 @@ module Gitlab end def database_configuration - @uses_legacy_database_config = false # rubocop:disable Gitlab/ModuleWithInstanceVariables - super.to_h do |env, configs| - # TODO: To be removed in 15.0. See https://gitlab.com/gitlab-org/gitlab/-/issues/338182 - # This preload is needed to convert legacy `database.yml` - # from `production: adapter: postgresql` - # into a `production: main: adapter: postgresql` - unless Gitlab::Utils.to_boolean(ENV['SKIP_DATABASE_CONFIG_VALIDATION'], default: false) - # This check is taken from Rails where the transformation - # of a flat database.yml is done into `primary:` - # https://github.com/rails/rails/blob/v6.1.4/activerecord/lib/active_record/database_configurations.rb#L169 - if configs.is_a?(Hash) && !configs.all? { |_, v| v.is_a?(Hash) } - configs = { "main" => configs } - - @uses_legacy_database_config = true # rubocop:disable Gitlab/ModuleWithInstanceVariables - end - end - if Gitlab.ee? if !configs.key?("geo") && File.exist?(Rails.root.join("config/database_geo.yml")) configs["geo"] = Rails.application.config_for(:database_geo).stringify_keys diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 369cf5b3cd0..a7c5ff7138c 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -38577,6 +38577,9 @@ msgstr "" msgid "This epic does not exist or you don't have sufficient permission." msgstr "" +msgid "This epic would exceed maximum number of related epics." +msgstr "" + msgid "This feature requires local storage to be enabled" msgstr "" diff --git a/spec/initializers/validate_database_config_spec.rb b/spec/initializers/validate_database_config_spec.rb index 209d9691350..5f3f950a852 100644 --- a/spec/initializers/validate_database_config_spec.rb +++ b/spec/initializers/validate_database_config_spec.rb @@ -39,47 +39,23 @@ RSpec.describe 'validate database config' do end context 'when config/database.yml is valid' do - context 'uses legacy syntax' do - let(:database_yml) do - <<-EOS - production: + let(:database_yml) do + <<-EOS + production: + main: adapter: postgresql encoding: unicode database: gitlabhq_production username: git password: "secure password" host: localhost - EOS - end - - it 'validates configuration with a warning' do - expect(main_object).to receive(:warn).with /uses a deprecated syntax for/ - - expect { subject }.not_to raise_error - end - - it_behaves_like 'with SKIP_DATABASE_CONFIG_VALIDATION=true' + EOS end - context 'uses new syntax' do - let(:database_yml) do - <<-EOS - production: - main: - adapter: postgresql - encoding: unicode - database: gitlabhq_production - username: git - password: "secure password" - host: localhost - EOS - end + it 'validates configuration without errors and warnings' do + expect(main_object).not_to receive(:warn) - it 'validates configuration without errors and warnings' do - expect(main_object).not_to receive(:warn) - - expect { subject }.not_to raise_error - end + expect { subject }.not_to raise_error end end diff --git a/spec/lib/gitlab/patch/database_config_spec.rb b/spec/lib/gitlab/patch/database_config_spec.rb index d6f36ab86d5..73dc84bb2ef 100644 --- a/spec/lib/gitlab/patch/database_config_spec.rb +++ b/spec/lib/gitlab/patch/database_config_spec.rb @@ -34,9 +34,8 @@ RSpec.describe Gitlab::Patch::DatabaseConfig do end end - context 'when a new syntax is used' do - let(:database_yml) do - <<-EOS + let(:database_yml) do + <<-EOS production: main: adapter: postgresql @@ -68,59 +67,9 @@ RSpec.describe Gitlab::Patch::DatabaseConfig do prepared_statements: false variables: statement_timeout: 15s - EOS - end - - include_examples 'hash containing main: connection name' - - it 'configuration is not legacy one' do - configuration.database_configuration - - expect(configuration.uses_legacy_database_config).to eq(false) - end + EOS end - context 'when a legacy syntax is used' do - let(:database_yml) do - <<-EOS - production: - adapter: postgresql - encoding: unicode - database: gitlabhq_production - username: git - password: "secure password" - host: localhost - - development: - adapter: postgresql - encoding: unicode - database: gitlabhq_development - username: postgres - password: "secure password" - host: localhost - variables: - statement_timeout: 15s - - test: &test - adapter: postgresql - encoding: unicode - database: gitlabhq_test - username: postgres - password: - host: localhost - prepared_statements: false - variables: - statement_timeout: 15s - EOS - end - - include_examples 'hash containing main: connection name' - - it 'configuration is legacy' do - configuration.database_configuration - - expect(configuration.uses_legacy_database_config).to eq(true) - end - end + include_examples 'hash containing main: connection name' end end |
