Skip to content
Snippets Groups Projects
Verified Commit bc9db79d authored by Adam Hegyi's avatar Adam Hegyi Committed by GitLab
Browse files

Merge branch 'id-rails-7.1-booting-issues' into 'master'

Fix booting issues for Rails 7.1

See merge request !161459



Merged-by: Adam Hegyi's avatarAdam Hegyi <ahegyi@gitlab.com>
Approved-by: Tian Gao's avatarTian Gao <tgao@gitlab.com>
Approved-by: default avatarGavin Hinfey <ghinfey@gitlab.com>
Approved-by: Adam Hegyi's avatarAdam Hegyi <ahegyi@gitlab.com>
Reviewed-by: Igor Drozdov's avatarIgor Drozdov <idrozdov@gitlab.com>
Co-authored-by: Igor Drozdov's avatarIgor Drozdov <idrozdov@gitlab.com>
parents e35338d4 66f83fd7
No related branches found
No related tags found
2 merge requests!162233Draft: Script to update Topology Service Gem,!161459Fix booting issues for Rails 7.1
Pipeline #1404749281 passed
......@@ -45,7 +45,8 @@ class UserPreference < ApplicationRecord
attribute :keyboard_shortcuts_enabled, default: true
attribute :use_web_ide_extension_marketplace, default: false
enum visibility_pipeline_id_type: { id: 0, iid: 1 }
enum :visibility_pipeline_id_type, { id: 0, iid: 1 }, scopes: false
enum extensions_marketplace_opt_in_status: Enums::WebIde::ExtensionsMarketplaceOptInStatus.statuses
enum organization_groups_projects_display: { projects: 0, groups: 1 }
......
......@@ -119,7 +119,13 @@ class Application < Rails::Application
config.generators.templates.push("#{config.root}/generator_templates")
foss_eager_load_paths = config.eager_load_paths.dup.freeze
foss_eager_load_paths =
if Gitlab.next_rails?
config.all_eager_load_paths.dup.freeze
else
config.eager_load_paths.dup.freeze
end
load_paths = ->(dir:) do
ext_paths = foss_eager_load_paths.each_with_object([]) do |path, memo|
ext_path = config.root.join(dir, Pathname.new(path).relative_path_from(config.root))
......
......@@ -22,7 +22,7 @@
# We can probably drop this patch for Rails 7.1 and up, but we might
# want to wait for https://github.com/rails/rails/pull/51441 or some
# mechanism that can disable the `Link` header.
if Gem::Version.new(ActionView.version) >= Gem::Version.new('7.1')
if Gem::Version.new(ActionView.version) >= Gem::Version.new('7.2')
raise 'New version of ActionView detected. This patch can likely be removed.'
end
......
......@@ -2,15 +2,16 @@
# As discussed in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/148637#note_1850247875,
# Rails 7.1 introduces enqueue_all which is not covered in this patch.
if Gem::Version.new(Rails.gem_version) >= Gem::Version.new('7.1')
raise 'New version of Rails detected, please remove or update this patch'
end
# We deliver emails using the `deliver_later` method and it uses ActiveJob
# under the hood, which later processes the email via the defined ActiveJob adapter's `enqueue` method.
# For GitLab, the ActiveJob adapter is Sidekiq (in development and production environments).
# We need to set the following up to override the ActiveJob adapater
# so as to ensure that mailer jobs are enqueued in a shard-aware manner.
if Gem::Version.new(Rails.gem_version) >= Gem::Version.new('7.2')
raise 'New version of Rails detected, please remove or update this patch'
end
module ActiveJob
module QueueAdapters
module ActiveJobShardSupport
......
# frozen_string_literal: true
# https://github.com/rails/rails/pull/46656 disables IRB auto-completion
# by default in Rails 7.1.
if Gem::Version.new(Rails.gem_version) >= Gem::Version.new('7.1') # rubocop:disable Style/GuardClause -- This is easier to read
raise 'New version of Rails detected, please remove USE_AUTOCOMPLETE override'
end
if Gitlab::Runtime.console?
# Stop irb from writing a history file by default.
module IrbNoHistory
......@@ -17,11 +11,13 @@ def init_config(*)
init_autocomplete
end
def init_autocomplete
return unless Rails.env.production?
unless ::Gitlab.next_rails?
def init_autocomplete
return unless Rails.env.production?
# IRB_USE_AUTOCOMPLETE was added in https://github.com/ruby/irb/pull/469
IRB.conf[:USE_AUTOCOMPLETE] = ENV.fetch("IRB_USE_AUTOCOMPLETE", "false") == "true"
# IRB_USE_AUTOCOMPLETE was added in https://github.com/ruby/irb/pull/469
IRB.conf[:USE_AUTOCOMPLETE] = ENV.fetch("IRB_USE_AUTOCOMPLETE", "false") == "true"
end
end
end
......
......@@ -9,13 +9,13 @@
#
# It overrides the new behavior that removes the constant first:
#
# https://github.com/rails/rails/blob/v7.0.5/activerecord/lib/active_record/migration.rb#L1054
# https://github.com/rails/rails/blob/v7.1.3.4/activerecord/lib/active_record/migration.rb#L1186
# The following is a reminder for when we upgrade to Rails 7.1. In particular,
# The following is a reminder for when we upgrade to Rails 7.2. In particular,
# we need to pay special attention to ensure that our ActiveRecord overrides are
# compatible.
if ::ActiveRecord::VERSION::STRING >= "7.1"
if ::ActiveRecord::VERSION::STRING >= "7.2"
raise 'New version of active-record detected, please remove or update this patch'
end
......
......@@ -70,7 +70,7 @@
expect(pref.visibility_pipeline_id_type).to eq('id')
end
it { is_expected.to define_enum_for(:visibility_pipeline_id_type).with_values(id: 0, iid: 1) }
it { is_expected.to define_enum_for(:visibility_pipeline_id_type) }
end
describe 'extensions_marketplace_opt_in_status' do
......
......@@ -79,7 +79,12 @@
RSpec.configure do |config|
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
config.fixture_path = Rails.root
if ::Gitlab.next_rails?
config.fixture_paths = [Rails.root]
else
config.fixture_path = Rails.root
end
config.verbose_retry = true
config.display_try_failure_messages = true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment