Skip to content
Snippets Groups Projects
Commit c3ca895d23e4 authored by DJ Mountney's avatar DJ Mountney
Browse files

Merge branch 'make-ruby3-default' into 'master'

Bump Ruby version to 3.0.5

Closes #6287

See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/6736



Merged-by: default avatarDJ Mountney <dj@gitlab.com>
Approved-by: default avatarDJ Mountney <dj@gitlab.com>
Co-authored-by: default avatarBalasankar "Balu" C <balasankar@gitlab.com>
No related branches found
No related tags found
2 merge requests!102heptapod#1237: making 0.38 the new oldstable,!92Merging upstream 15.10.0+ce.0
......@@ -61,6 +61,8 @@
QA_BRANCH: 'master'
ISSUE_BOT_LABELS_EXTRA: "group::distribution"
BUNDLER_VERSION: "2.3.22"
# NOTE: When `NEXT_RUBY_VERSION` is updated, flip
# `USE_NEXT_RUBY_VERSION_IN_*` variables to false to avoid surprises.
NEXT_RUBY_VERSION: "3.0.5"
GET_GEO_TAG: "0.4.0"
CANONICAL_PROJECT_PATH: 'gitlab-org/omnibus-gitlab'
......
......@@ -22,5 +22,5 @@
skip_transitive_dependency_licensing true
# Follow the Ruby upgrade guidewhen changing the ruby version
# Follow the Ruby upgrade guide when changing the ruby version
# link: https://docs.gitlab.com/ee/development/ruby_upgrade.html
......@@ -26,10 +26,29 @@
# link: https://docs.gitlab.com/ee/development/ruby_upgrade.html
# Bundle Ruby 2 if either (or multiple) of the following conditions are met:
# 1. `RUBY2_BUILD` variable is set to true
# 2. Running on stable branch
# 3. Running on regular (non-auto-deploy) tag
# 4. Running on auto-deploy tag, but variable `USE_NEXT_RUBY_VERSION_IN_AUTODEPLOY` is not set to true
# In all other scenarios, bundle Ruby 3
if Gitlab::Util.get_env('RUBY2_BUILD') == 'true' || Build::Check.on_stable_branch? || Build::Check.on_regular_tag? || (Build::Check.is_auto_deploy_tag? && Gitlab::Util.get_env('USE_NEXT_RUBY_VERSION_IN_AUTODEPLOY') != "true")
default_version '2.7.7'
current_ruby_version = '3.0.5'
# NOTE: When this value is updated, flip `USE_NEXT_RUBY_VERSION_IN_*` variable
# to false to avoid surprises.
next_ruby_version = Gitlab::Util.get_env('NEXT_RUBY_VERSION') || '3.0.5'
# MRs targeting stable branches should use current Ruby version and ignore next
# Ruby version. Also, we provide `USE_OLD_RUBY_VERSION` variable to force usage
# of current Ruby version.
if Gitlab::Util.get_env('RUBY2_BUILD') == "true" || Gitlab::Util.get_env('USE_OLD_RUBY_VERSION') == "true" || Gitlab::Util.get_env('CI_MERGE_REQUEST_TARGET_BRANCH_NAME')&.match?(/^\d+-\d+-stable$/)
default_version current_ruby_version
# Regular branch builds are switched to newer Ruby version first. So once the
# `NEXT_RUBY_VERSION` variable is updated, regular branches (master and feature
# branches) start bundling that version of Ruby. Because nightlies are also
# technically regular branch builds and because they get auto-deployed to
# dev.gitlab.org, we provide a variable `USE_NEXT_RUBY_VERSION_IN_NIGHTLY` to
# control it.
elsif (Build::Check.on_regular_branch? && !Build::Check.is_nightly?) || (Build::Check.is_nightly? && Gitlab::Util.get_env('USE_NEXT_RUBY_VERSION_IN_NIGHTLY') == "true")
default_version next_ruby_version
# Once feature branches and nightlies have switched to newer Ruby version and
# we are ready to switch auto-deploy releases to GitLab.com to the new
# version, flipe the `USE_NEXT_RUBY_VERSION_IN_AUTODEPLOY` to `true`
elsif Build::Check.is_auto_deploy_tag? && Gitlab::Util.get_env('USE_NEXT_RUBY_VERSION_IN_AUTODEPLOY') == "true"
default_version next_ruby_version
# Once we see new Ruby version running fine in GitLab.com, set new Ruby version
# as `current_ruby_version` so that they get used in stable branches and tag
# builds. This change marks "Switch Ruby to new version" as complete.
else
......@@ -35,5 +54,5 @@
else
default_version Gitlab::Util.get_env('NEXT_RUBY_VERSION') || '3.0.5'
default_version current_ruby_version
end
fips_enabled = Build::Check.use_system_ssl?
......
......@@ -83,6 +83,10 @@
def on_stable_branch?
Build::Info.branch_name&.match?(/^\d+-\d+-stable$/)
end
def on_regular_branch?
Build::Info.branch_name && !on_stable_branch?
end
end
end
end
......@@ -261,4 +261,65 @@
end
end
end
describe 'on_regular_branch?' do
context 'when on a regular branch' do
before do
stub_env_var('CI_COMMIT_BRANCH', 'my-feature-branch')
allow(described_class).to receive(:system).with(/git describe --exact-match/).and_return(false)
end
it 'returns false' do
expect(described_class.on_regular_branch?).to be_truthy
end
end
context 'when on a stable branch' do
before do
stub_env_var('CI_COMMIT_BRANCH', '15-6-stable')
allow(described_class).to receive(:system).with(/git describe --exact-match/).and_return(false)
end
it 'returns false' do
expect(described_class.on_regular_branch?).to be_falsey
end
end
context 'when on RC tag' do
before do
stub_env_var('CI_COMMIT_BRANCH', '')
stub_env_var('CI_COMMIT_TAG', '15.8.0+rc42.ce.0')
allow(described_class).to receive(:system).with(/git describe --exact-match/).and_return(true)
end
it 'returns true' do
expect(described_class.on_regular_branch?).to be_falsey
end
end
context 'when on stable tag' do
before do
stub_env_var('CI_COMMIT_BRANCH', '')
stub_env_var('CI_COMMIT_TAG', '15.8.0+ce.0')
allow(described_class).to receive(:system).with(/git describe --exact-match/).and_return(true)
end
it 'returns true' do
expect(described_class.on_regular_branch?).to be_falsey
end
end
context 'when on auto-deploy tag' do
before do
stub_env_var('CI_COMMIT_BRANCH', '')
stub_env_var('CI_COMMIT_TAG', '15.8.202301050320+b251a9da107.0e5d6807f3a')
allow(Build::Info).to receive(:current_git_tag).and_return('15.8.202301050320+b251a9da107.0e5d6807f3a')
allow(described_class).to receive(:system).with(/git describe --exact-match/).and_return(true)
end
it 'returns false' do
expect(described_class.on_regular_branch?).to be_falsey
end
end
end
end
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