Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci/ipsec: Fix downgrade version for release preparation commits
For the IPsec upgrade/downgrade CI test, for the jobs where we upgrade/downgrade to the closest patch release, the script print-downgrade-version.sh determines the patch release by picking up the value in file VERSION. This works most of the time. For release preparation commits, however, this approach fails because the reference in VERSION points to a release that has not been tagged or published yet. We need to pick the previous patch release in that case. However, it's non-trivial to figure out whether we're on a release preparation commit, in particular because the CI workflow does a shallow Git clone and we don't have access to the Git history. I couldn't find an ideal solution, so this commit changes the shallow-clone and makes it fetch the tags, as well, so that we're allow to check for the tag existence before returning it. If the tag is not available, we decrement the patch version found in VERSION before computing the patch release to downgrade to. Note that we do not expect this second attempt (with the patch release number decremented) to fail, so we do not check for its existence in the Git history: if we did, and printed an error in the script but returned an empty value, we'd skip the rest of the CI workflow. Instead, if we're in a situation where this decremented patch release number is returned but is not a valid one, CI will attempt to run the workflow with it, and fail loudly, which is what we want in that case. Sample output from the script: VERSION Prevous minor Previous patch release 1.14.3 v1.13 v1.14.3 1.14.1 v1.13 v1.14.1 1.14.0 v1.13 <error> 1.14.1-dev v1.13 v1.14.1 1.15.0-dev v1.14 <error> 1.13.90 v1.12 v1.13.89 <-- decremented 2.0.1 <error> v2.0.0 <-- decremented Fixes: 5581963 ("ci/ipsec: Fix version retrieval for downgrades to closest patch release") Signed-off-by: Quentin Monnet <quentin@isovalent.com>
- Loading branch information