From ec6a185adc42dc4513180a33b7d8271c65ba3b22 Mon Sep 17 00:00:00 2001 From: Hinsteny Hisoka Date: Thu, 15 Jun 2023 15:21:54 +0800 Subject: [PATCH] feat: support only build one plugin to testing specified WasmPlugin (#371) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 澄潭 --- test/README.md | 1 + tools/hack/build-wasm-plugins.sh | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/test/README.md b/test/README.md index 1a152fb40..d5fb6b86c 100644 --- a/test/README.md +++ b/test/README.md @@ -19,6 +19,7 @@ Higress provides make target to run ingress api conformance tests and wasmplugin + API Tests: `make ingress-conformance-test` + WasmPlugin Tests: `make ingress-wasmplugin-test` + + Only build one WasmPlugin for testing: `PLUGIN_NAME=request-block make ingress-wasmplugin-test` It can be divided into below steps: diff --git a/tools/hack/build-wasm-plugins.sh b/tools/hack/build-wasm-plugins.sh index 088574493..4a9074ea5 100755 --- a/tools/hack/build-wasm-plugins.sh +++ b/tools/hack/build-wasm-plugins.sh @@ -18,6 +18,19 @@ set -euo pipefail cd ./plugins/wasm-go/ -# developer need to declear new wasmplugins here for test -PLUGIN_NAME=http-call make build -PLUGIN_NAME=request-block make build \ No newline at end of file +INNER_PLUGIN_NAME=${PLUGIN_NAME-""} +if [ ! -n "$INNER_PLUGIN_NAME" ]; then + EXTENSIONS_DIR=$(pwd)"/extensions/" + echo "build all wasmplugins under folder of $EXTENSIONS_DIR" + for file in `ls $EXTENSIONS_DIR` + do + if [ -d $EXTENSIONS_DIR$file ]; then + name=${file##*/} + echo "build wasmplugin name of $name" + PLUGIN_NAME=${name} make build + fi + done +else + echo "build wasmplugin name of $INNER_PLUGIN_NAME" + PLUGIN_NAME=${INNER_PLUGIN_NAME} make build +fi