Skip to content

Commit

Permalink
chore(build): using a custom image, provide more feedback
Browse files Browse the repository at this point in the history
now reports the image name, as well as the Kong version detected
within that image
  • Loading branch information
Tieske committed Feb 7, 2024
1 parent 7bf3c09 commit 79d6aaa
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pongo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -556,16 +556,24 @@ function get_license {
}


GET_VERSION_RAN=false
function get_version {
# if $KONG_IMAGE is not yet set, it will get the image (see get_image).
# Then it will read the Kong version from the image (by executing "kong version")
#
# Result: $VERSION will be read from the image, and $KONG_TEST_IMAGE will be set.
# NOTE1: $KONG_TEST_IMAGE is only a name, the image might not have been created yet
# NOTE2: if it is a development tag, then $VERSION will be a commit-id
local custom_image=false
if [[ -z $KONG_IMAGE ]]; then
validate_version "$KONG_VERSION"
get_image
else
custom_image=true
if [[ "$GET_VERSION_RAN" == "false" ]]; then
# display message only once
msg "using provided Kong image '$KONG_IMAGE'"
fi
fi

get_license
Expand All @@ -581,6 +589,10 @@ function get_version {
if [[ "$VERSION" == "" ]]; then
err "Got an empty commit-id from Kong image: $KONG_IMAGE, label: org.opencontainers.image.revision"
fi
if [[ "$GET_VERSION_RAN" == "false" ]]; then
# display message only once
msg "using Kong development/commit based version '$VERSION'"
fi

else
# regular Kong version, so extract the Kong version number
Expand All @@ -599,8 +611,17 @@ function get_version {
if [[ ! $? -eq 0 ]]; then
err "failed to read version from Kong image: $KONG_IMAGE"
fi

# if a custom_iamge, report the version found
if [[ "$custom_image" == "true" ]]; then
if [[ "$GET_VERSION_RAN" == "false" ]]; then
# display message only once
msg "Kong image '$KONG_IMAGE' reported version '$VERSION'"
fi
fi
fi

GET_VERSION_RAN=true
KONG_TEST_IMAGE=$IMAGE_BASE_NAME:$VERSION
}

Expand Down

0 comments on commit 79d6aaa

Please sign in to comment.