From 34ff9981521f66254c2156162b08033d66864a02 Mon Sep 17 00:00:00 2001 From: Wangchong Zhou Date: Tue, 7 Jun 2022 19:41:28 +0800 Subject: [PATCH] fix(proto) move all proto files to /usr/local/kong/include (#483) A sister PR will open at Kong side --- build-kong.sh | 16 ++++++++-------- test/tests/01-package/run.sh | 9 +++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/build-kong.sh b/build-kong.sh index ddcd1636..a193e3f3 100755 --- a/build-kong.sh +++ b/build-kong.sh @@ -24,7 +24,6 @@ export PATH=$PATH:/usr/local/openresty/luajit/bin /usr/local/openresty/bin/openresty -v pushd /kong - cp -r kong/include /tmp/build/usr/local/kong/lib/ || true ROCKSPEC_VERSION=`basename /kong/kong-*.rockspec` \ && ROCKSPEC_VERSION=${ROCKSPEC_VERSION%.*} \ && ROCKSPEC_VERSION=${ROCKSPEC_VERSION#"kong-"} @@ -41,18 +40,19 @@ pushd /kong mkdir -p /tmp/build/etc/kong cp kong.conf.default /tmp/build/usr/local/lib/luarocks/rock*/kong/$ROCKSPEC_VERSION/ cp kong.conf.default /tmp/build/etc/kong/kong.conf.default - cp kong/pluginsocket.proto /tmp/build/usr/local/kong/lib + # /usr/local/kong/include is usually created by other C libraries, like openssl + # call mkdir here to make sure it's created + mkdir -p /tmp/build/usr/local/kong/include + cp -r kong/include/* /tmp/build/usr/local/kong/include/ - # collect proto files (for, at minimum, wrpc & analytics) - # see also: - # https://github.com/Kong/kong-distributions/pull/774 - if [ -d "/kong/kong/include/kong" ]; then - cp -r /kong/kong/include/kong /tmp/build/usr/local/kong/lib + # circular dependency of CI: remove after https://github.com/Kong/kong-distributions/pull/791 is merged + if [ -e "kong/pluginsocket.proto" ]; then + cp kong/pluginsocket.proto /tmp/build/usr/local/kong/include/kong fi curl -fsSLo /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.19.0/protoc-3.19.0-linux-x86_64.zip unzip -o /tmp/protoc.zip -d /tmp/protoc 'include/*' - cp -r /tmp/protoc/include/google /tmp/build/usr/local/kong/lib + cp -r /tmp/protoc/include/google /tmp/build/usr/local/kong/include/ popd cp /kong/COPYRIGHT /tmp/build/usr/local/kong/ diff --git a/test/tests/01-package/run.sh b/test/tests/01-package/run.sh index ce32beb8..360420d9 100644 --- a/test/tests/01-package/run.sh +++ b/test/tests/01-package/run.sh @@ -107,15 +107,16 @@ docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "grep # kong shipped files docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "ls -l /etc/kong/kong.conf.default" docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "ls -l /etc/kong/kong*.logrotate" -docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "ls -l /usr/local/kong/lib/pluginsocket.proto" -docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "ls -l /usr/local/kong/lib/google/protobuf/*.proto" +docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "ls -l /usr/local/kong/include/kong/pluginsocket.proto" +docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "ls -l /usr/local/kong/include/wrpc/wrpc.proto" +docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "ls -l /usr/local/kong/include/google/protobuf/*.proto" if [[ "$EDITION" == "enterprise" ]]; then docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /usr/local/openresty/bin/resty -e 'require("ffi").load "passwdqc"' docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /usr/local/openresty/bin/resty -e 'require("ffi").load "jq"' #docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} openapi2kong 2>&1 | head -1 | grep 'missing required parameter:' - docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} ls -l /usr/local/kong/lib/pluginsocket.proto - docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/bash -c "ls -l /usr/local/kong/lib/google/protobuf/*.proto" + docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} ls -l /usr/local/kong/include/kong/pluginsocket.proto + docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/bash -c "ls -l /usr/local/kong/include/google/protobuf/*.proto" fi # kong binaries