From 9ddab4ef45d1f67764132c552624937edde27905 Mon Sep 17 00:00:00 2001 From: Colin Hutchinson Date: Wed, 7 Dec 2022 14:14:15 +0000 Subject: [PATCH 1/4] chore(deps): bump the atc-router version --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 5e576c4..2573a12 100644 --- a/.env +++ b/.env @@ -4,4 +4,4 @@ PCRE_VERSION=8.45 KONG_NGINX_MODULE_VERSION=0.4.0 LUA_RESTY_LMDB_VERSION=1.0.0 LUA_RESTY_EVENTS_VERSION=0.1.3 -ATC_ROUTER_VERSION=1.0.35 +ATC_ROUTER_VERSION=1.4.1 From 7febf2ce7b1347d61233c3c77a5b46d85857ec94 Mon Sep 17 00:00:00 2001 From: Colin Hutchinson Date: Wed, 7 Dec 2022 15:01:46 +0000 Subject: [PATCH 2/4] fix(testing): lost the testing part of the Dockerfile --- Dockerfile | 2 ++ build.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 99d3967..4ef47fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,8 @@ WORKDIR /tmp RUN /tmp/build.sh +RUN /tmp/test.sh + # Copy the build result to scratch so we can export the result FROM scratch as package diff --git a/build.sh b/build.sh index cabf9c8..80dacef 100755 --- a/build.sh +++ b/build.sh @@ -94,7 +94,7 @@ function main() { package_architecture=x86_64 if [ "$(arch)" == "aarch64" ]; then - package_architecture=aarch64 + package_architecture=aarch64 fi curl -fsSLo atc-router.tar.gz https://github.com/hutchic/atc-router/releases/download/$ATC_ROUTER_VERSION/$package_architecture-unknown-$OSTYPE.tar.gz From 991aeb49f589a27d48244d5756df9a4f82544264 Mon Sep 17 00:00:00 2001 From: Colin Hutchinson Date: Wed, 7 Dec 2022 16:50:10 +0000 Subject: [PATCH 3/4] tests(atc-router): test that atc-router is correctly linked --- .env | 2 +- test.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.env b/.env index 2573a12..f5d3006 100644 --- a/.env +++ b/.env @@ -4,4 +4,4 @@ PCRE_VERSION=8.45 KONG_NGINX_MODULE_VERSION=0.4.0 LUA_RESTY_LMDB_VERSION=1.0.0 LUA_RESTY_EVENTS_VERSION=0.1.3 -ATC_ROUTER_VERSION=1.4.1 +ATC_ROUTER_VERSION=1.4.9 diff --git a/test.sh b/test.sh index 42629ef..6d9e676 100755 --- a/test.sh +++ b/test.sh @@ -15,15 +15,20 @@ function test() { /usr/local/kong/bin/openssl version # From kong-openssl test.sh ls -la /usr/local/kong/lib/libyaml.so # From kong-openssl test.sh + ldd /usr/local/kong/lib/libyaml.so + ldd /usr/local/kong/bin/openssl /usr/local/openresty/bin/openresty -v 2>&1 | grep -q ${OPENRESTY_VERSION} /usr/local/openresty/bin/openresty -V 2>&1 | grep -q pcre + ldd /usr/local/openresty/bin/openresty /usr/local/openresty/bin/resty -e 'print(jit.version)' | grep -q 'LuaJIT[[:space:]][[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+-[[:digit:]]\{8\}' ls -l /usr/local/openresty/lualib/resty/websocket/*.lua grep _VERSION /usr/local/openresty/lualib/resty/websocket/*.lua luarocks --version + ldd /usr/local/openresty/lualib/libatc_router.so + mv /tmp/buffer /tmp/build } From 22c2947eb0d65e3d69c94bdeed16650c5634268f Mon Sep 17 00:00:00 2001 From: Colin Hutchinson Date: Thu, 8 Dec 2022 05:23:17 +0000 Subject: [PATCH 4/4] test(openssl): use the parent test scripts as a sanity check pre and post isntallation --- Dockerfile | 23 ++++++++++++++++------- build.sh | 6 ++++++ test.sh | 11 +++++------ 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4ef47fc..bc16c9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,10 @@ ARG DOCKER_REGISTRY=ghcr.io ARG DOCKER_IMAGE_NAME # List out all image permutations to trick dependabot -FROM --platform=linux/amd64 ghcr.io/kong/kong-openssl:1.1.3-x86_64-linux-musl as x86_64-linux-musl -FROM --platform=linux/amd64 ghcr.io/kong/kong-openssl:1.1.3-x86_64-linux-gnu as x86_64-linux-gnu -FROM --platform=linux/arm64 ghcr.io/kong/kong-openssl:1.1.3-aarch64-linux-musl as aarch64-linux-musl -FROM --platform=linux/arm64 ghcr.io/kong/kong-openssl:1.1.3-aarch64-linux-gnu as aarch64-linux-gnu +FROM --platform=linux/amd64 ghcr.io/kong/kong-openssl:1.1.5-x86_64-linux-musl as x86_64-linux-musl +FROM --platform=linux/amd64 ghcr.io/kong/kong-openssl:1.1.5-x86_64-linux-gnu as x86_64-linux-gnu +FROM --platform=linux/arm64 ghcr.io/kong/kong-openssl:1.1.5-aarch64-linux-musl as aarch64-linux-musl +FROM --platform=linux/arm64 ghcr.io/kong/kong-openssl:1.1.5-aarch64-linux-gnu as aarch64-linux-gnu # Run the build script @@ -16,9 +16,18 @@ FROM $ARCHITECTURE-$OSTYPE as build COPY . /tmp WORKDIR /tmp -RUN /tmp/build.sh - -RUN /tmp/test.sh +# Run our predecessor tests +# Configure, build, and install +# Run our own tests +# Re-run our predecessor tests +RUN /test/*/test.sh && \ + /tmp/build.sh && \ + /tmp/test.sh && \ + /test/*/test.sh + +# Test scripts left where downstream images can run them +COPY test.sh /test/kong-runtime/test.sh +COPY .env /test/kong-runtime/.env # Copy the build result to scratch so we can export the result FROM scratch as package diff --git a/build.sh b/build.sh index 80dacef..cfa6ed0 100755 --- a/build.sh +++ b/build.sh @@ -10,6 +10,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) export $(grep -v '^#' $SCRIPT_DIR/.env | xargs) function main() { + echo '--- installing kong runtime ---' with_backoff curl --fail -sSLo pcre.tar.gz "https://downloads.sourceforge.net/project/pcre/pcre/${PCRE_VERSION}/pcre-${PCRE_VERSION}.tar.gz" tar -xzvf pcre.tar.gz ln -s pcre-${PCRE_VERSION} pcre @@ -39,6 +40,7 @@ function main() { popd pushd openresty-${OPENRESTY_VERSION} + echo '--- installing openresty ---' OPENRESTY_OPTS=( "--prefix=/usr/local/openresty" "--with-pcre-jit" @@ -79,8 +81,10 @@ function main() { pushd /tmp/lua-resty-events make install LUA_LIB_DIR=/tmp/build/usr/local/openresty/lualib popd + echo '--- installed openresty ---' pushd /tmp/luarocks-${LUAROCKS_VERSION} + echo '--- installing luarocks ---' ./configure \ --prefix=/usr/local \ --with-lua=/tmp/build/usr/local/openresty/luajit \ @@ -88,6 +92,7 @@ function main() { make build -j2 make install DESTDIR=/tmp/build + echo '--- installed luarocks ---' popd arch=$(uname -m) @@ -105,6 +110,7 @@ function main() { mkdir -p /tmp/build/usr/local/lib/lua sed -i 's/\/tmp\/build//' `grep -l -I -r '\/tmp\/build' /tmp/build/` + echo '--- installed kong runtime ---' } # Retries a command a configurable number of times with backoff. diff --git a/test.sh b/test.sh index 6d9e676..e9735e0 100755 --- a/test.sh +++ b/test.sh @@ -10,17 +10,15 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) export $(grep -v '^#' $SCRIPT_DIR/.env | xargs) function test() { + echo '--- testing kong runtime (openresty, luarocks) ---' cp -R /tmp/build/* / mv /tmp/build /tmp/buffer # Check we didn't link dependencies to `/tmp/build/...` - /usr/local/kong/bin/openssl version # From kong-openssl test.sh - ls -la /usr/local/kong/lib/libyaml.so # From kong-openssl test.sh - ldd /usr/local/kong/lib/libyaml.so - ldd /usr/local/kong/bin/openssl - /usr/local/openresty/bin/openresty -v 2>&1 | grep -q ${OPENRESTY_VERSION} /usr/local/openresty/bin/openresty -V 2>&1 | grep -q pcre - ldd /usr/local/openresty/bin/openresty + /usr/local/openresty/bin/openresty -V 2>&1 | grep -q lua-kong-nginx-module + /usr/local/openresty/bin/openresty -V 2>&1 | grep -q lua-resty-lmdb + /usr/local/openresty/bin/openresty -V 2>&1 | grep -q lua-resty-events /usr/local/openresty/bin/resty -e 'print(jit.version)' | grep -q 'LuaJIT[[:space:]][[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+-[[:digit:]]\{8\}' ls -l /usr/local/openresty/lualib/resty/websocket/*.lua @@ -30,6 +28,7 @@ function test() { ldd /usr/local/openresty/lualib/libatc_router.so mv /tmp/buffer /tmp/build + echo '--- tested kong runtime ---' } test