From 507775715a22e419d1c7e42028f7c3b5d9cf0418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Garc=C3=ADa=20Cota?= Date: Mon, 22 May 2023 18:34:14 +0200 Subject: [PATCH] Release 3.3.0 (#654) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Hans Hübner --- Dockerfile.apk | 14 +- Dockerfile.deb | 4 +- Dockerfile.rpm | 6 +- tests/02-customize.test.sh | 260 ------------------------------------- ubuntu/Dockerfile | 8 +- update.sh | 24 ++-- 6 files changed, 24 insertions(+), 292 deletions(-) delete mode 100755 tests/02-customize.test.sh diff --git a/Dockerfile.apk b/Dockerfile.apk index 89410202..5fbb822c 100644 --- a/Dockerfile.apk +++ b/Dockerfile.apk @@ -3,11 +3,10 @@ FROM alpine:3.17 LABEL maintainer="Kong Docker Maintainers (@team-gateway-bot)" -ARG KONG_VERSION=3.1.1 +ARG KONG_VERSION=3.3.0 ENV KONG_VERSION $KONG_VERSION -ARG KONG_AMD64_SHA="9194977814e91b6997ce4795957d9b4bcec9d220667e01a08ade7ac64704f57c" -ARG KONG_ARM64_SHA="92d98307a3193602bbe4dbed2d099cde5404a8acd09d53f0b9a9f2bcf6038500" +ARG KONG_AMD64_SHA="494522d5ef9baf674272bbb7075e406a4515a7475253fd3026cc7ca9451612a2" ARG KONG_PREFIX=/usr/local/kong ENV KONG_PREFIX $KONG_PREFIX @@ -19,17 +18,14 @@ COPY kong.apk.tar.gz /tmp/kong.apk.tar.gz RUN set -ex; \ apk add --virtual .build-deps curl tar gzip ca-certificates; \ - arch="$(apk --print-arch)"; \ - case "${arch}" in \ - x86_64) export ARCH='amd64'; KONG_SHA256=$KONG_AMD64_SHA ;; \ - aarch64) export ARCH='arm64'; KONG_SHA256=$KONG_ARM64_SHA ;; \ - esac; \ + export ARCH='amd64'; \ + KONG_SHA256=$KONG_AMD64_SHA ; \ if [ "$ASSET" = "remote" ] ; then \ curl -fL "https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-alpine/kong-${KONG_VERSION}.${ARCH}.apk.tar.gz" -o /tmp/kong.apk.tar.gz \ && echo "$KONG_SHA256 /tmp/kong.apk.tar.gz" | sha256sum -c -; \ fi \ && tar -C / -xzf /tmp/kong.apk.tar.gz \ - && apk add --no-cache libstdc++ libgcc perl tzdata libcap zlib zlib-dev bash \ + && apk add --no-cache libstdc++ libgcc perl tzdata libcap zlib zlib-dev bash yaml \ && adduser -S kong \ && addgroup -S kong \ && mkdir -p "${KONG_PREFIX}" \ diff --git a/Dockerfile.deb b/Dockerfile.deb index e8d2dab9..badbc973 100644 --- a/Dockerfile.deb +++ b/Dockerfile.deb @@ -3,10 +3,10 @@ FROM debian:bullseye-20230502-slim LABEL maintainer="Kong Docker Maintainers (@team-gateway-bot)" -ARG KONG_VERSION=3.1.1 +ARG KONG_VERSION=3.3.0 ENV KONG_VERSION $KONG_VERSION -ARG KONG_SHA256="c9cd059e13f9eb5ee894f2d83dc0a77c649adbb636fcbfed66841960b6f00f0d" +ARG KONG_SHA256="2fcfaa2095d2eb9dc91820f2f5f0e623b0b8a7457ddcb6ddf5761f4cb02d14e9" ARG KONG_PREFIX=/usr/local/kong ENV KONG_PREFIX $KONG_PREFIX diff --git a/Dockerfile.rpm b/Dockerfile.rpm index 8f9a3432..7c7f8ad6 100644 --- a/Dockerfile.rpm +++ b/Dockerfile.rpm @@ -3,7 +3,7 @@ FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7@sha256:6910799b75ad41f00891 LABEL maintainer="Kong Docker Maintainers (@team-gateway-bot)" -ARG KONG_VERSION=3.1.1 +ARG KONG_VERSION=3.3.0 ENV KONG_VERSION $KONG_VERSION # RedHat required labels @@ -18,7 +18,7 @@ LABEL name="Kong" \ # RedHat required LICENSE file approved path COPY LICENSE /licenses/ -ARG KONG_SHA256="70e43c48c2c404d7a8092a13a5857e36d469668d508b19f7fe70c4351c7b533d" +ARG KONG_SHA256="d5aef8421e962b97bb734bacb443ddf40733acfad61bf3cf97611619c348b2f6" ARG KONG_PREFIX=/usr/local/kong ENV KONG_PREFIX $KONG_PREFIX @@ -31,7 +31,7 @@ COPY kong.rpm /tmp/kong.rpm # hadolint ignore=DL3015 RUN set -ex; \ if [ "$ASSET" = "remote" ] ; then \ - DOWNLOAD_URL="https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-rhel-8/Packages/k/kong-$KONG_VERSION.rhel8.6.amd64.rpm" \ + DOWNLOAD_URL="https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-rhel-8/Packages/k/kong-$KONG_VERSION.rhel8.amd64.rpm" \ && curl -fL $DOWNLOAD_URL -o /tmp/kong.rpm \ && echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c - \ || exit 1; \ diff --git a/tests/02-customize.test.sh b/tests/02-customize.test.sh deleted file mode 100755 index a88e3170..00000000 --- a/tests/02-customize.test.sh +++ /dev/null @@ -1,260 +0,0 @@ -#!/usr/bin/env bash - -# to run this test locally do the following: -# > docker pull kong:latest -# > docker tag kong:latest kong-alpine -# > BASE=alpine tests/02-customize.test.sh - - -function build_custom_image { - # arg1: plugins; eg. "kong-http-to-https,kong-upstream-jwt" - # arg2: template; eg. "/mykong/nginx.conf" - # arg3: path to local rockserver dir; eg. "/some/dir/rockserver" - local plugins - local template - local rockserver - if [[ ! "$1" == "" ]]; then - plugins="--build-arg PLUGINS=$1" - fi - if [[ ! "$2" == "" ]]; then - cp $2 ./custom.conf - template="--build-arg TEMPLATE=./custom.conf" - fi - if [[ ! "$3" == "" ]]; then - # rockserver must be within docker build context, so copy files there - mkdir rockserver - ls $3 - cp -r -v "$3" . - rockserver="--build-arg ROCKS_DIR=./rockserver" - fi - #export BUILDKIT_PROGRESS=plain - docker build --build-arg KONG_BASE="kong-$BASE" \ - --build-arg "KONG_LICENSE_DATA=$KONG_LICENSE_DATA" \ - $plugins \ - $template \ - $rockserver \ - --tag "kong-$BASE-customize" \ - . - local result=$? - # cleanup the temporary files/directories - if [ -d rockserver ]; then - rm -rf rockserver - fi - if [ -f custom.conf ]; then - rm custom.conf - fi - return $result -} - -function delete_custom_image { - docker rmi "kong-$BASE-customize" > /dev/null 2>&1 -} - -unset TEST_CMD_OPTS -function run_kong_cmd { - docker run -ti --rm $TEST_CMD_OPTS "kong-$BASE-customize" $1 -} - - - -function run_test { - # the suite name below will only be used when rtunning this file directly, when - # running through "test.sh" it must be provided using the "--suite" option. - tinitialize "Docker-Kong test suite" "${BASH_SOURCE[0]}" - - local mypath - mypath=$(dirname "$(realpath "$0")") - pushd "$mypath/../customize" - - - - tchapter "Customize $BASE" - - ttest "injects a plugin, pure-Lua" - local test_plugin_name="kong-upstream-jwt" - build_custom_image "$test_plugin_name" - if [ ! $? -eq 0 ]; then - tfailure - else - run_kong_cmd "luarocks list --porcelain" | grep $test_plugin_name - if [ ! $? -eq 0 ]; then - tmessage "injected plugin '$test_plugin_name' was not found" - tfailure - else - tsuccess - fi - fi - delete_custom_image - - - - ttest "injects a plugin, with self-contained C code (no binding)" - local test_plugin_name="lua-protobuf" - build_custom_image "$test_plugin_name" - if [ ! $? -eq 0 ]; then - tfailure - else - run_kong_cmd "luarocks list --porcelain" | grep $test_plugin_name - if [ ! $? -eq 0 ]; then - tmessage "injected plugin '$test_plugin_name' was not found" - tfailure - else - tsuccess - fi - fi - delete_custom_image - - - - ttest "injects a plugin with local rockserver" - local test_plugin_name="kong-plugin-myplugin" - build_custom_image "$test_plugin_name" "" "$mypath/rockserver" - if [ ! $? -eq 0 ]; then - tfailure - else - run_kong_cmd "luarocks list --porcelain" | grep $test_plugin_name - if [ ! $? -eq 0 ]; then - tmessage "injected plugin '$test_plugin_name' was not found" - tfailure - else - tsuccess - fi - fi - delete_custom_image - - - - ttest "build image to test KONG_PLUGINS settings" - local test_plugin_name="kong-plugin-myplugin" - build_custom_image "$test_plugin_name" "" "$mypath/rockserver" - if [ ! $? -eq 0 ]; then - tfailure - else - tsuccess - fi - - ttest "injected plugin are added to KONG_PLUGINS if not set" - unset TEST_CMD_OPTS - run_kong_cmd "printenv" | grep "bundled,myplugin" - if [ ! $? -eq 0 ]; then - tmessage "injected plugin '$test_plugin_name' was not found in KONG_PLUGIN" - tfailure - else - tsuccess - fi - - ttest "injected plugin are added to KONG_PLUGINS if set with 'bundled'" - TEST_CMD_OPTS="-e KONG_PLUGINS=bundled,custom-one" - run_kong_cmd "printenv" | grep "bundled,myplugin,custom-one" - if [ ! $? -eq 0 ]; then - tmessage "injected plugin '$test_plugin_name' was not found in KONG_PLUGIN" - tfailure - else - tsuccess - fi - - ttest "injected plugin are NOT added to KONG_PLUGINS if set without 'bundled'" - TEST_CMD_OPTS="-e KONG_PLUGINS=custom-one,custom-two" - run_kong_cmd "printenv" | grep "$test_plugin_name" - if [ $? -eq 0 ]; then - tmessage "injected plugin '$test_plugin_name' was found in KONG_PLUGIN, but was not expected" - tfailure - else - tsuccess - fi - - # cleanup - unset TEST_CMD_OPTS - delete_custom_image - - - - ttest "fails injecting an unavailable plugin with local rockserver" - # the plugin is PUBLICLY available, but NOT on our local one, so should fail - local test_plugin_name="kong-upstream-jwt" - build_custom_image "$test_plugin_name" "" "$mypath/rockserver" - if [ ! $? -eq 0 ]; then - tsuccess - else - tmessage "injected plugin '$test_plugin_name' which was not on the local rockserver" - tfailure - fi - delete_custom_image - - - - ttest "injects a custom template" - build_custom_image "" "$mypath/bad_file.conf" - if [ ! $? -eq 0 ]; then - tfailure - else - docker run -it -d \ - -e "KONG_DATABASE=off" \ - --name "kong-testsuite-container" \ - "kong-$BASE-customize:latest" kong start - - sleep 3 - OUTPUT=$(docker logs kong-testsuite-container) - echo "$OUTPUT" - echo "$OUTPUT" | grep "nginx configuration is invalid" - - if [ $? -eq 0 ]; then - tmessage "container failed to start because of invalid config, as expected" - tsuccess - else - tmessage "container is running, while it should have failed to start" - tfailure - fi - docker rm --force kong-testsuite-container - fi - delete_custom_image - - - - ttest "injects a custom template and a plugin" - local test_plugin_name="kong-plugin-myplugin" - build_custom_image "$test_plugin_name" "$mypath/bad_file.conf" "$mypath/rockserver" - if [ ! $? -eq 0 ]; then - tfailure - else - # check if plugin was injected - run_kong_cmd "luarocks list --porcelain" | grep $test_plugin_name - if [ ! $? -eq 0 ]; then - tmessage "injected plugin '$test_plugin_name' was not found" - tfailure - else - # now check if the template was added - docker run -it -d \ - -e "KONG_DATABASE=off" \ - --name "kong-testsuite-container" \ - "kong-$BASE-customize:latest" kong start - - sleep 3 - OUTPUT=$(docker logs kong-testsuite-container) - echo "$OUTPUT" - echo "$OUTPUT" | grep "nginx configuration is invalid" - - if [ $? -eq 0 ]; then - tmessage "container failed to start because of invalid config, as expected" - tsuccess - else - tmessage "container is running, while it should have failed to start" - tfailure - fi - docker rm --force kong-testsuite-container - fi - fi - delete_custom_image - - - - popd - tfinish -} - - -# No need to modify anything below this comment - -# shellcheck disable=SC1090 # do not follow source -[[ "$T_PROJECT_NAME" == "" ]] && set -e && if [[ -f "${1:-$(dirname "$(realpath "$0")")/test.sh}" ]]; then source "${1:-$(dirname "$(realpath "$0")")/test.sh}"; else source "${1:-$(dirname "$(realpath "$0")")/run.sh}"; fi && set +e -run_test diff --git a/ubuntu/Dockerfile b/ubuntu/Dockerfile index 45a27266..fbab1033 100644 --- a/ubuntu/Dockerfile +++ b/ubuntu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:focal +FROM ubuntu:jammy LABEL maintainer="Kong Docker Maintainers (@team-gateway-bot)" @@ -9,11 +9,11 @@ ARG EE_PORTS COPY kong.deb /tmp/kong.deb -ARG KONG_VERSION=3.1.1 +ARG KONG_VERSION=3.3.0 ENV KONG_VERSION $KONG_VERSION -ARG KONG_AMD64_SHA="39bbefa14d348dedf7734c742da46acf7777ff0018f2cad7961799ba4663277b" -ARG KONG_ARM64_SHA="ff2f7b5d0dc3bd97e08fe4254400daf8a7d23f6ef2e72d9cec7c14e64bbc38b3" +ARG KONG_AMD64_SHA="e8c5fe8cacf19477d37a3b16375a263183f0c87c9ec217c4ead0c774d286be5b" +ARG KONG_ARM64_SHA="2d918f7dd1ca5d54a6832cc370892a99af8e39fc4040df66d2d7ca6d97b9a2b5" # hadolint ignore=DL3015 RUN set -ex; \ diff --git a/update.sh b/update.sh index 456d22a1..b4769e23 100755 --- a/update.sh +++ b/update.sh @@ -57,22 +57,18 @@ fi 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.apk arm64) - echo $url - curl -fL $url -o /tmp/kong - new_sha=$(sha256sum /tmp/kong | cut -b1-64) + # Note: Our Bazel-based build currently (3.2.x) does not support Alpine arm64 builds + # url=$(get_url Dockerfile.apk 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 + # 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 # Dockerfile.deb @@ -85,14 +81,14 @@ 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=focal") + 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=focal") + url=$(get_url Dockerfile arm64 "UBUNTU_CODENAME=jammy") echo $url curl -fL $url -o /tmp/kong new_sha=$(sha256sum /tmp/kong | cut -b1-64)