Consider only existing SemVer/RC tags for finding next Helm charts version
While releasing a new major version, our logic is "Get all the tags in the repo, find the latest tag from it, then find the next major tag after it". The problem is "Get all the tags in the repo" will include auto-deploy tags also. If auto-deploy tags are considered, then VersionSorter.sort will return the latest auto-deploy tag. Then we will attempt to do next_major
on that tag, which returns 1.0.0
because it is not a SemVer tag.
❯ pry
[1] pry(main)> require_relative 'lib/release_tools.rb'
=> true
[2] pry(main)> versions = ["v2.7.0", "v3.3.5", "13.1.202005221140+d56014265e6"]
=> ["v2.7.0", "v3.3.5", "13.1.202005221140+d56014265e6"]
[3] pry(main)> max_version = VersionSorter.sort(versions).last
=> "13.1.202005221140+d56014265e6"
[4] pry(main)> max_helm_version = ReleaseTools::HelmGitlabVersion.new(max_version.sub('v', ''))
=> "13.1.202005221140+d56014265e6"
[5] pry(main)> max_helm_version.next_major
=> "1.0.0"
Why this bit us now? When we initially wrote this, auto-deploy tags weren't in the picture. And this is the first major release after they got introduced.
Edited by Alessio Caiazza