Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump the atc-router version #7

Merged
merged 4 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -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.9
21 changes: 16 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,7 +16,18 @@ FROM $ARCHITECTURE-$OSTYPE as build
COPY . /tmp
WORKDIR /tmp

RUN /tmp/build.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
Expand Down
8 changes: 7 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -39,6 +40,7 @@ function main() {
popd

pushd openresty-${OPENRESTY_VERSION}
echo '--- installing openresty ---'
OPENRESTY_OPTS=(
"--prefix=/usr/local/openresty"
"--with-pcre-jit"
Expand Down Expand Up @@ -79,22 +81,25 @@ 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 \
--with-lua-include=/tmp/build/usr/local/openresty/luajit/include/luajit-2.1

make build -j2
make install DESTDIR=/tmp/build
echo '--- installed luarocks ---'
popd

arch=$(uname -m)

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
Expand All @@ -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.
Expand Down
10 changes: 7 additions & 3 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,25 @@ 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

/usr/local/openresty/bin/openresty -v 2>&1 | grep -q ${OPENRESTY_VERSION}
/usr/local/openresty/bin/openresty -V 2>&1 | grep -q pcre
/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
grep _VERSION /usr/local/openresty/lualib/resty/websocket/*.lua
luarocks --version

ldd /usr/local/openresty/lualib/libatc_router.so

mv /tmp/buffer /tmp/build
echo '--- tested kong runtime ---'
}

test