Skip to content

Commit

Permalink
fix(versions): resolve EE-versions by the last 2 digits
Browse files Browse the repository at this point in the history
Enterprise versions have pacth versions both on 3rd and 4th digit
whilst resolving only took 4th into account.
Eg. 3.4.1.x resolved to 3.4.1.1, whilst 3.4.2.0 is actually the latest
  • Loading branch information
Tieske committed Dec 4, 2023
1 parent 4272f0e commit 4d0a319
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions assets/set_variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,28 @@ function resolve_version {
# resolve trailing "x" to proper version
local new_version=$KONG_VERSION
local entry
for entry in ${KONG_VERSIONS[*]}; do
if [[ "${KONG_VERSION:0:${#KONG_VERSION}-1}" == "${entry:0:${#entry}-1}" ]]; then
# keep replacing, last one wins
new_version=$entry
fi
done;

local segments
segments=segments=$(( $(echo "$KONG_VERSION" | tr -cd '.' | wc -c) + 1 ))

if ((segments == 4)); then
# this is a 4 segment version, which means it is an EE version.
# For an EE version we need to resolve the last 2 segments
for entry in ${KONG_VERSIONS[*]}; do
if [[ "${KONG_VERSION:0:${#KONG_VERSION}-3}" == "${entry:0:${#entry}-3}" ]]; then
# keep replacing, last one wins
new_version=$entry
fi
done;
else
# this should then be an OSS version
for entry in ${KONG_VERSIONS[*]}; do
if [[ "${KONG_VERSION:0:${#KONG_VERSION}-1}" == "${entry:0:${#entry}-1}" ]]; then
# keep replacing, last one wins
new_version=$entry
fi
done;
fi
if [[ "$new_version" == "$KONG_VERSION" ]]; then
warn "Could not resolve Kong version: '$KONG_VERSION'"
else
Expand Down

0 comments on commit 4d0a319

Please sign in to comment.