Stub 17.0 version info

Test purposes only.
Used to verify upgrade path behaviour.
This commit is contained in:
Clemens Beck 2024-04-30 14:50:30 +02:00
parent 0c8e92a936
commit 78cbb686a3
No known key found for this signature in database
GPG Key ID: 4EC101F2BFCCFEFA
2 changed files with 3 additions and 57 deletions

View File

@ -87,6 +87,7 @@ if old_version=$(cat /var/opt/gitlab/gitlab-rails/VERSION)
then
GITLAB_UPGRADE='true'
new_version=$(awk '/^gitlab-(ce|ee|jh)/ {print $NF}' /opt/gitlab/version-manifest.txt)
new_version="17.0.0"
gitlab-ctl upgrade-check "${old_version}" "${new_version}"
fi

View File

@ -46,66 +46,11 @@ module Build
# TODO, merge latest_tag with latest_stable_tag
# TODO, add tests, needs a repo clone
def latest_tag
unless (fact_from_file = Gitlab::Util.fetch_fact_from_file(__method__)).nil?
return fact_from_file
end
tags = sorted_tags_for_edition
return if tags.empty?
version = branch_name.delete_suffix('-stable').tr('-', '.') if Build::Check.on_stable_branch?
output = tags.find { |t| t.start_with?(version) } if version
# If no tags corresponding to the stable branch version was found, we
# fall back to the latest available tag
output || tags.first
'17.0.0+ee.0'
end
def latest_stable_tag(level: 1)
unless (fact_from_file = Gitlab::Util.fetch_fact_from_file(__method__)).nil?
return fact_from_file
end
# Exclude RC tags so that we only have stable tags.
stable_tags = sorted_tags_for_edition.reject { |t| t.include?('rc') }
return if stable_tags.empty?
version = branch_name.delete_suffix('-stable').tr('-', '.') if Build::Check.on_stable_branch?
results = stable_tags.select { |t| t.start_with?(version) } if version
# If no tags corresponding to the stable branch version was found, we
# fall back to the latest available stable tag
output = if results.nil? || results.empty?
stable_tags
else
results
end
# Level decides tag at which position you want. Level one gives you
# latest stable tag, two gives you the one just before it and so on.
# Since arrays start from 0, we subtract 1 from the specified level to
# get the index. If the specified level is more than the number of
# tags, we return the last tag.
if level >= output.length
output.last
else
output[level - 1]
end
end
private
def sorted_tags_for_edition
Gitlab::Util.shellout_stdout("git -c versionsort.prereleaseSuffix=rc tag -l '#{tag_match_pattern}' --sort=-v:refname")&.split("\n")
end
def tag_match_pattern
return '*[+.]ee.*' if Build::Check.is_ee?
'*[+.]ce.*'
'17.0.0+ee.0'
end
end
end