Skip to content

Commit

Permalink
fix upgrade from version for RC tags (projectcontour#5334)
Browse files Browse the repository at this point in the history
Closes projectcontour#5328.

Signed-off-by: Steve Kriss <[email protected]>
  • Loading branch information
skriss authored May 2, 2023
1 parent 65d38a4 commit 6cdbb32
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/scripts/get-contour-upgrade-from-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ set -o nounset
set -o pipefail

if CURRENT_TAG=$(git describe --tags --exact-match 2>/dev/null); then
# We are on a tag, so find previous tag to this one.
git tag -l --sort=-v:refname | grep -v 'alpha\|beta\|rc' | grep -A1 -x $CURRENT_TAG | tail -1
# We are on a tag, so find previous tag to this one:
# - list them sorted in reverse semver order
# - find the current tag + the 5 previous (enough to filter out pre-release tags and still be left with a previous release tag)
# - exclude the current tag (which may be a pre-release or not)
# - exclude all remaining pre-release tags
# - get the highest remaining tag
git tag -l --sort=-v:refname | grep -A5 -x $CURRENT_TAG | grep -v -x $CURRENT_TAG | grep -v 'alpha\|beta\|rc' | head -n 1
elif git describe --tags --abbrev=0 | grep -q -v v1.2.0; then
# Note: Contour v1.2.0 was improperly tagged on main so we
# ignore it to ensure we dont hit that case here.
Expand Down

0 comments on commit 6cdbb32

Please sign in to comment.