diff --git a/.github/workflows/deploy-with-docker.yml b/.github/workflows/deploy-with-docker.yml index 256ebc3ee8..1f75f77985 100644 --- a/.github/workflows/deploy-with-docker.yml +++ b/.github/workflows/deploy-with-docker.yml @@ -47,4 +47,3 @@ jobs: run: | docker tag dashboard:ci apisixacr.azurecr.cn/dashboard:${{ github.sha }} docker push apisixacr.azurecr.cn/dashboard:${{ github.sha }} - diff --git a/api/build-tools/schema-sync.lua b/api/build-tools/schema-sync.lua index c7f973cc28..aa65c2ba6c 100644 --- a/api/build-tools/schema-sync.lua +++ b/api/build-tools/schema-sync.lua @@ -29,6 +29,7 @@ local fake_module_list = { 'pb', 'prometheus', 'protoc', + 'skywalking.tracer', 'resty.cookie', 'resty.core.regex', @@ -61,7 +62,8 @@ local fake_module_list = { 'apisix.plugins.skywalking.tracer', 'apisix.plugins.zipkin.codec', 'apisix.plugins.zipkin.random_sampler', - 'apisix.plugins.zipkin.reporter' + 'apisix.plugins.zipkin.reporter', + 'apisix.timers' } for _, name in ipairs(fake_module_list) do package.loaded[name] = {} @@ -77,6 +79,7 @@ ngx.re = {} ngx.timer = {} ngx.location = {} ngx.socket = {} +ngx.thread = {} ngx.re.gmatch = empty_function ngx.shared = { ["plugin-api-breaker"] = {} diff --git a/api/build-tools/schema-sync.sh b/api/build-tools/schema-sync.sh index 7de361ccae..a9a856da88 100755 --- a/api/build-tools/schema-sync.sh +++ b/api/build-tools/schema-sync.sh @@ -20,19 +20,29 @@ set -ex pwd=`pwd` -version="master" -if [[ -n $1 ]]; then -version=$1 +if [[ -n $1 && -d "$1" ]]; then + path=$1 + if [[ -d "${path}/apisix" ]]; then + cp -R ${path}/apisix/ ./api/build-tools/apisix/ + else + cp -R ${path}/ ./api/build-tools/apisix/ + fi +else + version="master" + if [[ -n $1 ]]; then + version=$1 + fi + wget -O $version.zip https://github.com/apache/apisix/archive/$version.zip + + unzip $version.zip + mkdir -p ./api/build-tools/apisix/ + cp -R ./apisix-$version/apisix/ ./api/build-tools/ + rm -rf ./apisix-$version fi -rm -rf ./api/build-tools/apisix/ -wget -O $version.zip https://github.com/apache/apisix/archive/$version.zip +cd ./api/build-tools/ && lua schema-sync.lua > ${pwd}/api/conf/schema.json && cd ../../ -unzip $version.zip -mkdir -p ./api/build-tools/apisix/ -mv ./apisix-$version/apisix/* ./api/build-tools/apisix/ -rm -rf ./apisix-$version -cd ./api/build-tools/ && lua schema-sync.lua > ${pwd}/api/conf/schema.json +rm -rf ./api/build-tools/apisix/ echo "sync success:" echo "${pwd}/api/conf/schema.json" diff --git a/docs/develop.md b/docs/develop.md index 1104cc5ad7..7df96e326a 100644 --- a/docs/develop.md +++ b/docs/develop.md @@ -87,7 +87,11 @@ $ make api-stop ### Sync jsonschema -To sync jsonschema from Apache APISIX, `Lua` 5.1+ and `zip` need to be preinstalled, then execute this command: `api/build-tools/schema-sync.sh $version`. +To sync jsonschema from Apache APISIX, `Lua` 5.1+ and `zip` need to be preinstalled, then execute this command: + +```sh +$ api/build-tools/schema-sync.sh $version +``` NOTE: `$version` should be `master` or Apache APISIX's version. @@ -100,3 +104,9 @@ $ api/build-tools/schema-sync.sh master # Using Apache APISIX's version $ api/build-tools/schema-sync.sh 2.0 ``` + +If you have custom plugin, please make sure your custom plugin is placed in the APISIX directory, and change the parameters of the execution script to the APISIX directory path, example: + +```sh +$ api/build-tools/schema-sync.sh /usr/local/apisix +``` diff --git a/docs/develop.zh-CN.md b/docs/develop.zh-CN.md index 12d81f8a86..c1d10c6b5b 100644 --- a/docs/develop.zh-CN.md +++ b/docs/develop.zh-CN.md @@ -89,7 +89,11 @@ $ make api-stop ### 同步 jsonschema -从 Apache APISIX 同步 jsonschema ,需要预安装 `Lua` 5.1+ 和 `zip` ,并执行命令 `api/build-tools/schema-sync.sh $version`。 +从 Apache APISIX 同步 jsonschema ,需要预安装 `Lua` 5.1+ 和 `zip` ,并执行命令 + +```sh +$ api/build-tools/schema-sync.sh $version +``` 注意:`$version` 为 `master` 或者 Apache APISIX 的版本号。 @@ -103,3 +107,8 @@ $ api/build-tools/schema-sync.sh master $ api/build-tools/schema-sync.sh 2.0 ``` +如果您有自定义插件,请确保您的自定义插件放在 APISIX 目录中,并将执行脚本的参数改为 APISIX 目录路径, 如: + +```sh +$ api/build-tools/schema-sync.sh /usr/local/apisix +```