Skip to content

Commit

Permalink
fix(proto) move all proto files to /usr/local/kong/include (#483)
Browse files Browse the repository at this point in the history
A sister PR will open at Kong side
  • Loading branch information
fffonion authored Jun 7, 2022
1 parent 9aa666a commit 34ff998
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
16 changes: 8 additions & 8 deletions build-kong.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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-"}
Expand All @@ -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/
Expand Down
9 changes: 5 additions & 4 deletions test/tests/01-package/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 34ff998

Please sign in to comment.