diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2021-08-17 18:30:08 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2021-08-18 08:54:31 +0300 |
commit | 7ca6284b658a2bd0fee1eafb450301d3455987e0 (patch) | |
tree | d7ded16e28d2b1790ae650d31008f5e649e4f55a /lib | |
parent | 97dcee492e06d79ea1ecc59d6aab2e4f572fb3c8 (diff) |
Automate the charts versions
With this, we no longer need to update a separate
charts_versions.yaml file.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/task_helpers.rb | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/task_helpers.rb b/lib/task_helpers.rb index 85a53c95..f9e307bd 100644 --- a/lib/task_helpers.rb +++ b/lib/task_helpers.rb @@ -53,15 +53,26 @@ def local_branch_exist?(branch) !status.empty? end -def chart_version_added?(gitlab_version) - config = YAML.load_file('./content/_data/chart_versions.yaml') - config.key?(gitlab_version) -end - +# +# The charts versions do not follow the same GitLab major number, BUT +# they do follow a pattern https://docs.gitlab.com/charts/installation/version_mappings.html: +# +# 1. The minor version is the same for both +# 2. The major version augments for both at the same time +# +# This means we can deduct the charts version from the GitLab version, since +# the major charts version is always 9 versions behind its GitLab counterpart. +# def chart_version(gitlab_version) - config = YAML.load_file('./content/_data/chart_versions.yaml') + major, minor = gitlab_version.split('.') + + # Assume major charts version is nine less than major GitLab version. + # If this breaks and the version isn't found, it might be because they + # are no longer exactly 9 releases behind. Ask the distribution team + # about it. + major = major.to_i - 9 - config.fetch(gitlab_version) + "#{major.to_s}.#{minor}" end def default_branch(repo) |