Skip to content

Commit

Permalink
ci/ipsec: Fix version retrieval for downgrades to closest patch release
Browse files Browse the repository at this point in the history
This commit brings two fixes to the script that we use to determine to
which version we should upgrade/downgrade in some CI workflows.

The first fix is the most important one. When looking for the closest
patch version, make the script return the value in VERSION instead of
decrementing it. The rationale is that for stable branches, VERSION
already points to the latest patch release, there is no need to decrease
it further! This fix does not affect the output for the calculation of
the previous minor version number.

The second fix is simply the addition of an error message in case the
minor version number is 0, to get some explicit error instead of a
silent failure if we ever reach Cilium 2.0.0.

Updated samples of numbers from VERSION and the corresponding values
returned:

    VERSION         Previous 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           <error>
    2.0.1           <error>         v2.0.1

Fixes: 56dfec2 ("contrib/scripts: Support patch releases in print-downgrade-version.sh")
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
  • Loading branch information
qmonnet authored and julianwiedmann committed Jan 29, 2024
1 parent b9fc7d8 commit 5581963
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contrib/scripts/print-downgrade-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ if [[ ${1-} == "patch" ]] ; then
exit 1
;;
*)
((patch--))
echo "v${major}.${minor}.${patch}${TAG_SUFFIX:-}"
;;
esac
else
if [[ "${minor}" == "0" ]] ; then
>&2 echo "ERROR: failed to deduce release previous to version '$VERSION'"
exit 1
fi
# Else print the previous stable version by decrementing the minor version
# and trimming the patch version.
((minor--))
Expand Down

0 comments on commit 5581963

Please sign in to comment.