Skip to content

Commit

Permalink
fix(ci): backport update.sh and Makefile from master
Browse files Browse the repository at this point in the history
  • Loading branch information
kikito committed Jun 25, 2024
1 parent 00b7a15 commit d940acc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT update KONG_BUILD_TOOLS manually - it's set by update.sh
# to ensure same version is used here and in the respective kong version
KONG_BUILD_TOOLS?=4.25.5
KONG_BUILD_TOOLS?=4.40.1
PACKAGE?=apk
BASE?=alpine
ASSET_LOCATION?=remote
Expand Down
49 changes: 10 additions & 39 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,55 +34,26 @@ function get_url() {

eval $args

raw_url=$(egrep -o 'https?://download.konghq.com/gateway-[^ ]+' $dockerfile | sed 's/\"//g')
raw_url=$(egrep -o 'https?://packages.konghq.com/public/gateway-[^ ]+' $dockerfile | sed 's/\"//g')

# set variables contained in raw url
KONG_VERSION=$version
KONG_REPO=$(echo ${KONG_VERSION%.*} | sed 's/\.//')
ARCH=$arch

eval echo $raw_url
}


hub --version &> /dev/null || die "hub is not in PATH. Get it from https://github.com/github/hub"

kbt_in_kong_v=$(curl -sL https://raw.githubusercontent.com/Kong/kong/$version/.requirements | grep 'KONG_BUILD_TOOLS_VERSION\=' | awk -F"=" '{print $2}' | tr -d "'[:space:]")
#kbt_in_kong_v=$(curl -sL https://raw.githubusercontent.com/Kong/kong/$version/.requirements | grep 'KONG_BUILD_TOOLS_VERSION\=' | awk -F"=" '{print $2}' | tr -d "'[:space:]")
kbt_in_kong_v=4.33.19
if [[ -n "$kbt_in_kong_v" ]]; then
sed -i.bak 's/KONG_BUILD_TOOLS?=.*/KONG_BUILD_TOOLS?='$kbt_in_kong_v'/g' Makefile
fi

pushd alpine
url=$(get_url Dockerfile amd64)
echo $url
curl -fL $url -o /tmp/kong
new_sha=$(sha256sum /tmp/kong | cut -b1-64)

sed -i.bak 's/ARG KONG_AMD64_SHA=.*/ARG KONG_AMD64_SHA=\"'$new_sha'\"/g' Dockerfile
sed -i.bak 's/ARG KONG_VERSION=.*/ARG KONG_VERSION='$version'/g' Dockerfile

sed -i.bak 's/ARG KONG_AMD64_SHA=.*/ARG KONG_AMD64_SHA=\"'$new_sha'\"/g' ../Dockerfile.apk
sed -i.bak 's/ARG KONG_VERSION=.*/ARG KONG_VERSION='$version'/g' ../Dockerfile.apk

url=$(get_url Dockerfile arm64)
echo $url
curl -fL $url -o /tmp/kong
new_sha=$(sha256sum /tmp/kong | cut -b1-64)

sed -i.bak 's/ARG KONG_ARM64_SHA=.*/ARG KONG_ARM64_SHA=\"'$new_sha'\"/g' Dockerfile
sed -i.bak 's/ARG KONG_VERSION=.*/ARG KONG_VERSION='$version'/g' Dockerfile

sed -i.bak 's/ARG KONG_ARM64_SHA=.*/ARG KONG_ARM64_SHA=\"'$new_sha'\"/g' ../Dockerfile.apk
sed -i.bak 's/ARG KONG_VERSION=.*/ARG KONG_VERSION='$version'/g' ../Dockerfile.apk
popd

pushd rhel
url=$(get_url Dockerfile amd64 "RHEL_VERSION=7")
echo $url
curl -fL $url -o /tmp/kong
new_sha=$(sha256sum /tmp/kong | cut -b1-64)

sed -i.bak 's/ARG KONG_SHA256=.*/ARG KONG_SHA256=\"'$new_sha'\"/g' Dockerfile
sed -i.bak 's/ARG KONG_VERSION=.*/ARG KONG_VERSION='$version'/g' Dockerfile
popd

# Dockerfile.deb
url=$(get_url Dockerfile.rpm amd64 "VERSION=8")
echo $url
curl -fL $url -o /tmp/kong
Expand All @@ -92,23 +63,23 @@ sed -i.bak 's/ARG KONG_SHA256=.*/ARG KONG_SHA256=\"'$new_sha'\"/g' Dockerfile.rp
sed -i.bak 's/ARG KONG_VERSION=.*/ARG KONG_VERSION='$version'/g' Dockerfile.rpm

pushd ubuntu
url=$(get_url Dockerfile amd64 "UBUNTU_CODENAME=bionic")
url=$(get_url Dockerfile amd64 "UBUNTU_CODENAME=jammy")
echo $url
curl -fL $url -o /tmp/kong
new_sha=$(sha256sum /tmp/kong | cut -b1-64)

sed -i.bak 's/ARG KONG_AMD64_SHA=.*/ARG KONG_AMD64_SHA=\"'$new_sha'\"/g' Dockerfile

url=$(get_url Dockerfile arm64 "UBUNTU_CODENAME=bionic")
url=$(get_url Dockerfile arm64 "UBUNTU_CODENAME=jammy")
echo $url
curl -fL $url -o /tmp/kong
new_sha=$(sha256sum /tmp/kong | cut -b1-64)

sed -i.bak 's/ARG KONG_ARM64_SHA=.*/ARG KONG_ARM64_SHA=\"'$new_sha'\"/g' Dockerfile

sed -i.bak 's/ARG KONG_VERSION=.*/ARG KONG_VERSION='$version'/g' Dockerfile
popd

# Dockerfile.deb
url=$(get_url Dockerfile.deb amd64 "CODENAME=bullseye")
echo $url
curl -fL $url -o /tmp/kong
Expand Down

0 comments on commit d940acc

Please sign in to comment.