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

Merge branch 'use-ruby3-in-ad-pipelines' into 'master'

Allow Ruby 3 to be used in auto-deploy pipelines

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



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
......@@ -22,9 +22,15 @@
skip_transitive_dependency_licensing true
if Gitlab::Util.get_env('RUBY2_BUILD') == 'true' || Build::Check.on_tag? || Build::Check.on_stable_branch?
# Follow the Ruby upgrade guidelines when changing the ruby version
# link: https://docs.gitlab.com/ee/development/ruby_upgrade.html
# Follow the Ruby upgrade guidewhen changing the ruby version
# 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'
else
default_version Gitlab::Util.get_env('NEXT_RUBY_VERSION') || '3.0.5'
......
......@@ -76,6 +76,10 @@
system('git describe --exact-match > /dev/null 2>&1')
end
def on_regular_tag?
on_tag? && !is_auto_deploy_tag?
end
def on_stable_branch?
Build::Info.branch_name&.match?(/^\d+-\d+-stable$/)
end
......
......@@ -200,4 +200,65 @@
end
end
end
describe 'on_regular_tag?' 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_tag?).to be_falsey
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_tag?).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_tag?).to be_truthy
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_tag?).to be_truthy
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_tag?).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