Draft: Introduce Gitlab.next_rails? to run Rails 7 tests

What does this MR do and why?

To implement the proposal, two rails versions in Gemfile can be specified:

def next?
  File.basename(__FILE__) == "Gemfile.next"
end

if next?
  gem 'rails', '~> 7.1.3.4', feature_category: :shared
else
  gem 'rails', '~> 7.0.8.4', feature_category: :shared
end

And Gemfile.next is a symlink to `Gemfile. After running

BUNDLE_GEMFILE=Gemfile.next BUNDLE_CACHE_PATH=vendor/cache.next bundle install
BUNDLE_GEMFILE=Gemfile.next BUNDLE_CACHE_PATH=vendor/cache.next bundle exec bundler-checksum lint

we have the following set of files:

Gemfile
Gemfile.lock
Gemfile.checksum
Gemfile.next
Gemfile.next.lock
Gemfile.next.checksum

The different paths in the codebase are controlled by Gitlab.next_rails? flag:

def self.next_rails?
  return @next_bundle_gemfile unless @next_bundle_gemfile.nil?

  @next_bundle_gemfile = File.exist?(ENV["BUNDLE_GEMFILE"]) && File.basename(ENV["BUNDLE_GEMFILE"]) == "Gemfile.next"
end

Let's see if the pipeline is green for Rails 7.0.8.4 version.

Edited by Igor Drozdov

Merge request reports

Loading