Latest stable tag detection can fail on first pipelines of a new stable branch
When a new stable branch is created, for example 15-11-stable
, the fact generation can fail due to latest stable tag computation not returning a value.
With !6118 (merged), Build::Info.latest_stable_tag
will behave differently on stable branches and other refs. On stable branches, it will return the latest stable tag corresponding to that version series (i.e, for 15-11-stable
, it will return the latest of 15.11.x
tags). For other refs, it will return the latest stable tag present in the repository (so if 16.1.0
is the latest stable tag in the repo, it will return that).
However, for the first pipelines of a stable branch before a tag exists in that version series, it will incorrectly return nil
, thus causing fact generation to fail. For example, for 15-11-stable
, the underlying code that is getting run is
git -c versionsort.prereleaseSuffix=rc tag -l '15.11*[+.]ee.*' --sort=-v:refname | awk '!/rc/' | head -1
Because not tags exist that matches 15.11*[+.]ee.*
, this command will return nil
.
Ideally, if a tag is not found in the current version series, the code should fallback to the available latest stable tag and return that.
Note that this will not happen in tag pipelines, feature branch pipelines, or even stable pipelines as part of backports. Only fresh stable branch pipelines before a tag is cut will have this problem.