[apisix] branch master updated: feat: add inspect plugin (#8400)

2022-12-15 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 8486800a7 feat: add inspect plugin (#8400)
8486800a7 is described below

commit 8486800a7cb7bffa74e5a59876acdd61191d3162
Author: jinhua luo 
AuthorDate: Fri Dec 16 10:09:22 2022 +0800

feat: add inspect plugin (#8400)
---
 Makefile  |   3 +
 apisix/inspect/dbg.lua| 151 ++
 apisix/inspect/init.lua   | 128 +
 apisix/plugins/inspect.lua|  61 +
 conf/config-default.yaml  |   4 +
 docs/assets/images/plugin/inspect.png | Bin 0 -> 31490 bytes
 docs/en/latest/config.json|   3 +-
 docs/en/latest/plugins/inspect.md | 171 
 t/admin/plugins.t |   1 +
 t/lib/test_inspect.lua|  62 +
 t/plugin/inspect.t| 499 ++
 11 files changed, 1082 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index f5908f71f..385e8ed46 100644
--- a/Makefile
+++ b/Makefile
@@ -301,6 +301,9 @@ install: runtime
$(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/include/apisix/model
$(ENV_INSTALL) apisix/include/apisix/model/*.proto 
$(ENV_INST_LUADIR)/apisix/include/apisix/model/
 
+   $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/inspect
+   $(ENV_INSTALL) apisix/inspect/*.lua $(ENV_INST_LUADIR)/apisix/inspect/
+
$(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins
$(ENV_INSTALL) apisix/plugins/*.lua $(ENV_INST_LUADIR)/apisix/plugins/
 
diff --git a/apisix/inspect/dbg.lua b/apisix/inspect/dbg.lua
new file mode 100644
index 0..a8a619a26
--- /dev/null
+++ b/apisix/inspect/dbg.lua
@@ -0,0 +1,151 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core = require("apisix.core")
+local string_format = string.format
+local debug = debug
+local ipairs = ipairs
+local pcall = pcall
+local table_insert = table.insert
+local jit = jit
+
+local _M = {}
+
+local hooks = {}
+
+function _M.getname(n)
+if n.what == "C" then
+return n.name
+end
+local lc = string_format("%s:%d", n.short_src, n.currentline)
+if n.what ~= "main" and n.namewhat ~= "" then
+return string_format("%s (%s)", lc, n.name)
+else
+return lc
+end
+end
+
+local function hook(_, arg)
+local level = 2
+local finfo = debug.getinfo(level, "nSlf")
+local key = finfo.source .. "#" .. arg
+
+local hooks2 = {}
+for _, hook in ipairs(hooks) do
+if key:sub(-#hook.key) == hook.key then
+local filter_func = hook.filter_func
+local info = {finfo = finfo, uv = {}, vals = {}}
+
+-- upvalues
+local i = 1
+while true do
+local name, value = debug.getupvalue(finfo.func, i)
+if name == nil then break end
+if name:sub(1, 1) ~= "(" then
+info.uv[name] = value
+end
+i = i + 1
+end
+
+-- local values
+local i = 1
+while true do
+local name, value = debug.getlocal(level, i)
+if not name then break end
+if name:sub(1, 1) ~= "(" then
+info.vals[name] = value
+end
+i = i + 1
+end
+
+local r1, r2_or_err = pcall(filter_func, info)
+if not r1 then
+core.log.error("inspect: pcall filter_func:", r2_or_err)
+elseif r2_or_err == false then
+-- if filter_func returns false, keep the hook
+table_insert(hooks2, hook)
+end
+else
+-- key not match, keep the hook
+table_insert(hooks2, hook)
+end
+end
+
+-- disable debug mode if all hooks done
+if #hooks2 ~= #hooks then
+hooks =

[apisix-java-plugin-runner] branch main updated: feat: add log4j2 configuration (#214)

2022-11-14 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new e18da5c  feat: add log4j2 configuration (#214)
e18da5c is described below

commit e18da5ca41607e7a6f79b53d9c1c85f0708025f4
Author: 张呈熹 
AuthorDate: Mon Nov 14 21:20:10 2022 +0800

feat: add log4j2 configuration (#214)
---
 .gitignore   |  1 +
 pom.xml  |  5 +++
 runner-core/pom.xml  |  4 ++
 runner-starter/src/main/resources/log4j2.xml | 59 
 4 files changed, 69 insertions(+)

diff --git a/.gitignore b/.gitignore
index 7eb9c23..7fe89e3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@ target/
 !**/src/main/**/target/
 !**/src/test/**/target/
 release/
+logs/
 
 ### IntelliJ IDEA ###
 .idea
diff --git a/pom.xml b/pom.xml
index 3495afd..c7a652d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,6 +88,11 @@
 pom
 import
 
+
+com.lmax
+disruptor
+3.4.4
+
 
 org.springframework.boot
 spring-boot-dependencies
diff --git a/runner-core/pom.xml b/runner-core/pom.xml
index ee178c5..2a50d77 100644
--- a/runner-core/pom.xml
+++ b/runner-core/pom.xml
@@ -63,6 +63,10 @@
 
 
 
+
+com.lmax
+disruptor
+
 
 io.netty
 netty-all
diff --git a/runner-starter/src/main/resources/log4j2.xml 
b/runner-starter/src/main/resources/log4j2.xml
new file mode 100644
index 000..fe2c888
--- /dev/null
+++ b/runner-starter/src/main/resources/log4j2.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+debug
+${sys:user.dir}
+${sys:file.encoding}
+
+
+
+
+
+
+
+%d %-5p %-32t - %m%n %throwable
+
+
+
+
+
+
+
+
+
+%d %-5p %-32t - %m%n %throwable
+
+
+
+
+
+
+
+
+
+
+
+
+
+



[apisix-java-plugin-runner] tag 0.4.0 created (now 9e393f6)

2022-11-10 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to tag 0.4.0
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


  at 9e393f6  (commit)
No new revisions were added by this update.



[apisix-java-plugin-runner] branch release/0.4.0 created (now 9e393f6)

2022-11-10 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/0.4.0
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


  at 9e393f6  feat: release 0.4.0

No new revisions were added by this update.



[apisix-java-plugin-runner] branch main updated: feat: release 0.4.0 (#212)

2022-11-10 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 2c53299  feat: release 0.4.0 (#212)
2c53299 is described below

commit 2c5329995273f8c2d74c065494d47bc12f0d467b
Author: tzssangglass 
AuthorDate: Fri Nov 11 10:45:23 2022 +0800

feat: release 0.4.0 (#212)
---
 CHANGELOG.md   | 10 ++
 Makefile   |  2 +-
 README.md  |  1 +
 docs/en/latest/installation-guide.md   |  2 +-
 pom.xml|  2 +-
 runner-core/pom.xml|  4 ++--
 runner-dist/apisix-runner-bin-dist/pom.xml |  2 +-
 runner-dist/apisix-runner-src-dist/pom.xml |  2 +-
 runner-dist/pom.xml|  4 ++--
 runner-plugin-sdk/pom.xml  |  2 +-
 runner-plugin/pom.xml  |  4 ++--
 runner-starter/pom.xml |  4 ++--
 sample/pom.xml |  4 ++--
 13 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 941ba3b..e2215b8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,10 +23,20 @@ title: Changelog
 
 ## Table of Contents
 
+- [0.4.0](#040)
 - [0.3.0](#030)
 - [0.2.0](#020)
 - [0.1.0](#010)
 
+## 0.4.0
+
+This release mainly provides the ability to get body data from upstream.
+
+### Core
+
+- support for getting upstream response body. 
[200](https://github.com/apache/apisix-java-plugin-runner/pull/200)
+- support watching config changes. 
[205](https://github.com/apache/apisix-java-plugin-runner/pull/208)
+
 ## 0.3.0
 
 This release mainly provides the ability to get headers from upstream, and 
support download the project from Maven Center.
diff --git a/Makefile b/Makefile
index a932f32..50b6c5a 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
 
 SHELL := /bin/bash -o pipefail
 
-VERSION ?= 0.3.0
+VERSION ?= 0.4.0
 RELEASE_SRC = apisix-java-plugin-runner-${VERSION}-src
 
 .PHONY: release-src
diff --git a/README.md b/README.md
index b680d2a..e96e2d6 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,7 @@ Version Matrix
 | 0.1.0 | >= 
[2.7.0](https://github.com/apache/apisix/blob/master/CHANGELOG.md#270)   |
 | 0.2.0 | >= 
[2.12.0](https://github.com/apache/apisix/blob/master/CHANGELOG.md#2102) |
 | 0.3.0 | >= 
[2.15.0](https://github.com/apache/apisix/blob/master/CHANGELOG.md#2150) |
+| 0.4.0 | >= 
[3.0.0](https://github.com/apache/apisix/blob/master/CHANGELOG.md#300)   |
 
 How it Works
 -
diff --git a/docs/en/latest/installation-guide.md 
b/docs/en/latest/installation-guide.md
index 5a4b58c..833afdd 100644
--- a/docs/en/latest/installation-guide.md
+++ b/docs/en/latest/installation-guide.md
@@ -48,7 +48,7 @@ Install
 
 org.apache.apisix 
 apisix-runner-starter
-0.3.1-SNAPSHOT
+0.4.0
 
 ```
 
diff --git a/pom.xml b/pom.xml
index 0d0ca54..3495afd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.1-SNAPSHOT
+0.4.0
   
 
 org.apache
diff --git a/runner-core/pom.xml b/runner-core/pom.xml
index f61a739..ee178c5 100644
--- a/runner-core/pom.xml
+++ b/runner-core/pom.xml
@@ -24,7 +24,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.1-SNAPSHOT
+0.4.0
 
 
 apisix-runner-core
@@ -36,7 +36,7 @@
 
 org.apache.apisix
 apisix-runner-plugin-sdk
-0.3.1-SNAPSHOT
+0.4.0
 
 
 org.springframework.boot
diff --git a/runner-dist/apisix-runner-bin-dist/pom.xml 
b/runner-dist/apisix-runner-bin-dist/pom.xml
index 69505d2..d393063 100644
--- a/runner-dist/apisix-runner-bin-dist/pom.xml
+++ b/runner-dist/apisix-runner-bin-dist/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-runner-dist
-0.3.1-SNAPSHOT
+0.4.0
 
 
 apisix-runner-bin-dist
diff --git a/runner-dist/apisix-runner-src-dist/pom.xml 
b/runner-dist/apisix-runner-src-dist/pom.xml
index a8b3ee6..212d9ce 100644
--- a/runner-dist/apisix-runner-src-dist/pom.xml
+++ b/runner-dist/apisix-runner-src-dist/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-runner-dist
-0.3.1-SNAPSHOT
+0.4.0
 
 
 apisix-runner-src-dist
diff --git a/runner-dist/pom.xml b/runner-dist/pom.xml
index 558b3b5..1aa63b1 100644
--- a/runner-dist/pom.xml
+++ b/runner-dist/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.1-SNAPSHOT
+0.4.0
 
 
 apisix-runner-dist
@@ -35,7 +35,7 @@
 
 org.apache.apisix
 apisix-ru

[apisix-java-plugin-runner] branch main updated: docs: improve quick start document (#213)

2022-11-08 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 902defc  docs: improve quick start document (#213)
902defc is described below

commit 902defc777bdd84680fdc5d10f3fc28a298c5c43
Author: 张呈熹 
AuthorDate: Wed Nov 9 14:58:30 2022 +0800

docs: improve quick start document (#213)
---
 docs/zh/quick-start.md | 25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/docs/zh/quick-start.md b/docs/zh/quick-start.md
index c0c8107..886e9de 100644
--- a/docs/zh/quick-start.md
+++ b/docs/zh/quick-start.md
@@ -22,13 +22,10 @@ public class CheckTokenFilter implements PluginFilter {
 }
 
 @Override
-public Mono filter(HttpRequest request, HttpResponse response, 
PluginFilterChain chain) {
+public void filter(HttpRequest request, HttpResponse response, 
PluginFilterChain chain) {
 /*
  * todo your business here
  */
-
-
-return chain.filter(request, response);
 }
 }
 ```
@@ -48,18 +45,17 @@ apisix-java-plugin-runner 与 APISIX 用 `Unix Domain Socket` 
进行进程间通
 构建完成,你会在 `dist` 目录看见构建产物
 
 ```
-apache-apisix-java-plugin-runner-0.1.0-bin.tar.gz
+apache-apisix-java-plugin-runner-${your_plugin_version}-bin.tar.gz
 ```
 
 在`dist`目录添加`Dockerfile`文件
 
 ```dockerfile
-FROM apache/apisix:${version}-alpine
-
-RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" 
/etc/apk/repositories && apk add --no-cache openjdk8-jre
+FROM apache/apisix:${version}-debian
 
-ADD apache-apisix-java-plugin-runner-0.1.0-bin.tar.gz /usr/local/
+RUN apt -y install openjdk-11-jdk
 
+ADD 
apache-apisix-java-plugin-runner-${your_plugin_version}-SNAPSHOT-bin.tar.gz 
/usr/local/
 ```
 
 然后构建容器镜像
@@ -73,11 +69,20 @@ ADD apache-apisix-java-plugin-runner-0.1.0-bin.tar.gz 
/usr/local/
 
 ```yaml
 ext-plugin:
-  cmd: ['java', '-jar', '-Xmx4g', '-Xms4g', 
'/path/to/apisix-runner-bin/apisix-java-plugin-runner.jar']
+  cmd: ['java', '-jar', '-Xmx4g', '-Xms4g', 
'/usr/local/apisix-runner-bin/apisix-java-plugin-runner.jar']
 ```
 
 构建完成的 `apache/apisix:${version}-alpine-with-java-plugin` 镜像内即包含 APISIX 与 
apisix-java-plugun-runner。
 
+### 调试
+如果需要调试插件, 可以将上述 ext-plugin 配置中添加调试参数: 
+```yaml
+ext-plugin:
+  cmd: ['java', '-jar', '-Xmx4g', 
'-Xms4g','-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005',
 '/usr/local/apisix-runner-bin/apisix-java-plugin-runner.jar']
+```
+
+就可以通过 Docker 的 5005 端口远程调试插件。
+
 ### 使用插件
 
 配置路由



[apisix-java-plugin-runner] branch release/0.4.0 created (now 9e393f6)

2022-11-06 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/0.4.0
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


  at 9e393f6  feat: release 0.4.0

No new revisions were added by this update.



[apisix-docker] branch release/apisix-3.0.0 created (now 86f65b7)

2022-11-01 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/apisix-3.0.0
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git


  at 86f65b7  feat: release APISIX 3.0.0 (#372)

No new revisions were added by this update.



[apisix] tag 3.0.0 created (now 24d1ec762)

2022-11-01 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to tag 3.0.0
in repository https://gitbox.apache.org/repos/asf/apisix.git


  at 24d1ec762 (commit)
No new revisions were added by this update.



[apisix-java-plugin-runner] branch main updated: feat: support watching config changes (#208)

2022-10-31 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 9c181d8  feat: support watching config changes (#208)
9c181d8 is described below

commit 9c181d814c903351e4bc092e30b33d7a5f159b4a
Author: JunXu Chen 
AuthorDate: Mon Oct 31 18:33:34 2022 +0800

feat: support watching config changes (#208)

Co-authored-by: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
---
 .../plugin/runner/handler/PrepareConfHandler.java  |  5 +++
 .../plugin/runner/server/ApplicationRunner.java| 20 ++---
 .../plugin/runner/handler/A6ConfigHandlerTest.java | 30 -
 .../runner/handler/A6HttpCallHandlerTest.java  |  9 +++-
 .../plugin/runner/handler/ExtraInfoTest.java   |  9 +++-
 .../plugin/runner/handler/PostFilterTest.java  | 10 -
 .../apisix/plugin/runner/handler/TestWatcher.java  | 49 ++
 .../apisix/plugin/runner/A6ConfigWatcher.java  | 36 
 8 files changed, 146 insertions(+), 22 deletions(-)

diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/PrepareConfHandler.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/PrepareConfHandler.java
index 799208a..6a7e9fa 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/PrepareConfHandler.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/PrepareConfHandler.java
@@ -26,6 +26,7 @@ import lombok.RequiredArgsConstructor;
 import org.apache.apisix.plugin.runner.A6Conf;
 import org.apache.apisix.plugin.runner.A6ConfigRequest;
 import org.apache.apisix.plugin.runner.A6ConfigResponse;
+import org.apache.apisix.plugin.runner.A6ConfigWatcher;
 import org.apache.apisix.plugin.runner.A6Request;
 import org.apache.apisix.plugin.runner.A6Response;
 import org.apache.apisix.plugin.runner.constants.Constants;
@@ -48,6 +49,7 @@ public class PrepareConfHandler extends 
SimpleChannelInboundHandler {
 
 private final Cache cache;
 private final Map filters;
+private final List watchers;
 
 @Override
 protected void channelRead0(ChannelHandlerContext ctx, A6Request request) {
@@ -75,6 +77,9 @@ public class PrepareConfHandler extends 
SimpleChannelInboundHandler {
 }
 A6Conf a6Conf = new A6Conf(config, chain);
 cache.put(token, a6Conf);
+for (A6ConfigWatcher watcher : watchers) {
+watcher.watch(token, a6Conf);
+}
 ctx.write(response);
 ctx.writeAndFlush(response);
 }
diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java
index 8c6ae48..865983a 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java
@@ -47,7 +47,9 @@ import io.netty.channel.unix.DomainSocketAddress;
 import io.netty.channel.unix.DomainSocketChannel;
 import io.netty.handler.logging.LoggingHandler;
 import lombok.RequiredArgsConstructor;
+
 import org.apache.apisix.plugin.runner.A6Conf;
+import org.apache.apisix.plugin.runner.A6ConfigWatcher;
 import org.apache.apisix.plugin.runner.filter.PluginFilter;
 import org.apache.apisix.plugin.runner.handler.PrepareConfHandler;
 import org.apache.apisix.plugin.runner.handler.RpcCallHandler;
@@ -67,21 +69,27 @@ public class ApplicationRunner implements CommandLineRunner 
{
 
 private Cache cache;
 
-private ObjectProvider beanProvider;
+private ObjectProvider filterProvider;
+private ObjectProvider watcherProvider;
 
 @Autowired
-public ApplicationRunner(Cache cache, 
ObjectProvider beanProvider) {
+public ApplicationRunner(Cache cache,
+ObjectProvider filterProvider, 
ObjectProvider watcherProvider) {
 this.cache = cache;
-this.beanProvider = beanProvider;
+this.filterProvider = filterProvider;
+this.watcherProvider = watcherProvider;
 }
 
-public PrepareConfHandler createConfigReqHandler(Cache 
cache, ObjectProvider beanProvider) {
+public PrepareConfHandler createConfigReqHandler(Cache cache,
+ObjectProvider beanProvider, 
ObjectProvider watcherProvider) {
 List pluginFilterList = 
beanProvider.orderedStream().collect(Collectors.toList());
 Map filterMap = new HashMap<>();
 for (PluginFilter filter : pluginFilterList) {
 filterMap.put(filter.name(), filter);
 }
-return new PrepareConfHandler(cache, filterMap);
+List configWatcherList = 
watcherProvider.orderedStream().collect(Collectors.toList());
+
+return new PrepareConfH

[apisix] branch release/3.0 created (now 24d1ec762)

2022-10-26 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/3.0
in repository https://gitbox.apache.org/repos/asf/apisix.git


  at 24d1ec762 fix patch version of file name

No new revisions were added by this update.



[apisix] branch master updated (df6923913 -> e523132f3)

2022-10-26 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


from df6923913 docs: refactor admin api doc (#8145)
 add e523132f3 feat: release 3.0 (#8179)

No new revisions were added by this update.

Summary of changes:
 .asf.yaml  |  4 +++
 CHANGELOG.md   | 37 ++
 apisix/core/version.lua|  2 +-
 docs/en/latest/building-apisix.md  |  2 +-
 docs/en/latest/config.json |  2 +-
 docs/zh/latest/CHANGELOG.md| 37 ++
 docs/zh/latest/building-apisix.md  |  2 +-
 docs/zh/latest/config.json |  2 +-
 ...x-master-0.rockspec => apisix-3.0.0-0.rockspec} |  4 +--
 9 files changed, 85 insertions(+), 7 deletions(-)
 copy rockspec/{apisix-master-0.rockspec => apisix-3.0.0-0.rockspec} (98%)



[apisix] branch release/3.0 updated (1f44be869 -> 24d1ec762)

2022-10-26 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/3.0
in repository https://gitbox.apache.org/repos/asf/apisix.git


from 1f44be869 fix patch version in rockspec
 add 24d1ec762 fix patch version of file name

No new revisions were added by this update.

Summary of changes:
 rockspec/{apisix-3.0-0.rockspec => apisix-3.0.0-0.rockspec} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename rockspec/{apisix-3.0-0.rockspec => apisix-3.0.0-0.rockspec} (100%)



[apisix] branch release/3.0 updated (6c61d380b -> 1f44be869)

2022-10-26 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/3.0
in repository https://gitbox.apache.org/repos/asf/apisix.git


from 6c61d380b add rockspec
 add 1f44be869 fix patch version in rockspec

No new revisions were added by this update.

Summary of changes:
 rockspec/apisix-3.0-0.rockspec | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



[apisix] branch release/3.0 updated (4105c094d -> 6c61d380b)

2022-10-25 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/3.0
in repository https://gitbox.apache.org/repos/asf/apisix.git


from 4105c094d feat: release 3.0
 add 6c61d380b add rockspec

No new revisions were added by this update.

Summary of changes:
 rockspec/{apisix-master-0.rockspec => apisix-3.0-0.rockspec} | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 copy rockspec/{apisix-master-0.rockspec => apisix-3.0-0.rockspec} (98%)



[apisix] branch release/3.0 created (now 4105c094d)

2022-10-25 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/3.0
in repository https://gitbox.apache.org/repos/asf/apisix.git


  at 4105c094d feat: release 3.0

This branch includes the following new commits:

 new 4105c094d feat: release 3.0

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[apisix] 01/01: feat: release 3.0

2022-10-25 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch release/3.0
in repository https://gitbox.apache.org/repos/asf/apisix.git

commit 4105c094dda05be43d50ced53bca7b01450071bd
Author: tzssangglass 
AuthorDate: Wed Oct 26 14:33:23 2022 +0800

feat: release 3.0
---
 .asf.yaml |  4 
 CHANGELOG.md  | 37 +
 apisix/core/version.lua   |  2 +-
 docs/en/latest/building-apisix.md |  2 +-
 docs/en/latest/config.json|  2 +-
 docs/zh/latest/CHANGELOG.md   | 37 +
 docs/zh/latest/building-apisix.md |  2 +-
 docs/zh/latest/config.json|  2 +-
 8 files changed, 83 insertions(+), 5 deletions(-)

diff --git a/.asf.yaml b/.asf.yaml
index 9038b5c11..6fb862a77 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -53,6 +53,10 @@ github:
   dismiss_stale_reviews: true
   require_code_owner_reviews: true
   required_approving_review_count: 2
+  release/3.0:
+required_pull_request_reviews:
+  require_code_owner_reviews: true
+  required_approving_review_count: 2
   release/2.99:
 required_pull_request_reviews:
   require_code_owner_reviews: true
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c849c9b40..edae58f4a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ title: Changelog
 
 ## Table of Contents
 
+- [3.0.0](#300)
 - [3.0.0-beta](#300-beta)
 - [2.15.0](#2150)
 - [2.14.1](#2141)
@@ -62,6 +63,42 @@ title: Changelog
 - [0.7.0](#070)
 - [0.6.0](#060)
 
+## 3.0.0
+
+### Change
+
+- `enable_cpu_affinity` is disabled by default to avoid this configuration 
affecting the behavior of APSISIX deployed in the container: 
[#8074](https://github.com/apache/apisix/pull/8074)
+
+### Core
+
+- :sunrise: Added Consumer Group entity to manage multiple consumers: 
[#7980](https://github.com/apache/apisix/pull/7980)
+- :sunrise: Supports configuring the order in which DNS resolves domain name 
types: [#7935](https://github.com/apache/apisix/pull/7935)
+- :sunrise: Support configuring multiple `key_encrypt_salt` for rotation: 
[#7925](https://github.com/apache/apisix/pull/7925)
+
+### Plugin
+
+- :sunrise: Added ai plugin to dynamically optimize the execution path of 
APISIX according to the scene:
+- [#8102](https://github.com/apache/apisix/pull/8102)
+- [#8113](https://github.com/apache/apisix/pull/8113)
+- [#8120](https://github.com/apache/apisix/pull/8120)
+- [#8128](https://github.com/apache/apisix/pull/8128)
+- [#8130](https://github.com/apache/apisix/pull/8130)
+- [#8149](https://github.com/apache/apisix/pull/8149)
+- [#8157](https://github.com/apache/apisix/pull/8157)
+- :sunrise: Support `session_secret` in openid-connect plugin to resolve the 
inconsistency of `session_secret` among multiple workers: 
[#8068](https://github.com/apache/apisix/pull/8068)
+- :sunrise: Support sasl config in kafka-logger plugin: 
[#8050](https://github.com/apache/apisix/pull/8050)
+- :sunrise: Support set resolve domain in proxy-mirror plugin: 
[#7861](https://github.com/apache/apisix/pull/7861)
+- :sunrise: Support `brokers` property in kafka-logger plugin, which supports 
different broker to set the same host: 
[#7999](https://github.com/apache/apisix/pull/7999)
+- :sunrise: Support get response body in ext-plugin-post-resp: 
[#7947](https://github.com/apache/apisix/pull/7947)
+- :sunrise: Added cas-auth plugin to support CAS authentication: 
[#7932](https://github.com/apache/apisix/pull/7932)
+
+### Bugfix
+
+- Conditional expressions of workflow plugin should support operators: 
[#8121](https://github.com/apache/apisix/pull/8121)
+- Fix loading problem of batch processor plugin when prometheus plugin is 
disabled: [#8079](https://github.com/apache/apisix/pull/8079)
+- When APISIX starts, delete the old conf server sock file if it exists: 
[#8022](https://github.com/apache/apisix/pull/8022)
+- Disable core.grpc when gRPC-client-nginx-module module is not compiled: 
[#8007](https://github.com/apache/apisix/pull/8007)
+
 ## 3.0.0-beta
 
 Here we use 2.99.0 as the version number in the source code instead of the 
code name
diff --git a/apisix/core/version.lua b/apisix/core/version.lua
index 3a6865a3b..cca6f0e02 100644
--- a/apisix/core/version.lua
+++ b/apisix/core/version.lua
@@ -20,5 +20,5 @@
 -- @module core.version
 
 return {
-VERSION = "2.99.0"
+VERSION = "3.0.0"
 }
diff --git a/docs/en/latest/building-apisix.md 
b/docs/en/latest/building-apisix.md
index eb7dd7fd9..f12fbfe08 100644
--- a/docs/en/latest/building-apisix.md
+++ b/docs/en/latest/building-apisix.md
@@ -52,7 +52,7 @@ curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/install-depend
 Then, create a directory and set the environment variable `APISIX_VERSION`:
 
 ```shell
-APISIX_VERSION='2.99.0'
+APISIX_VERSION='3.0.0'
 mk

[apisix-helm-chart] branch master updated: change: sync config of APISIX V3 version (#357)

2022-10-09 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
 new 7ddeca5  change: sync config of APISIX V3 version (#357)
7ddeca5 is described below

commit 7ddeca5395a2de96acd06bada30f3ab3580a6252
Author: tzssangglass 
AuthorDate: Sun Oct 9 17:01:05 2022 +0800

change: sync config of APISIX V3 version (#357)
---
 charts/apisix/templates/configmap.yaml | 752 ++---
 1 file changed, 514 insertions(+), 238 deletions(-)

diff --git a/charts/apisix/templates/configmap.yaml 
b/charts/apisix/templates/configmap.yaml
index 999b913..03eb3c0 100644
--- a/charts/apisix/templates/configmap.yaml
+++ b/charts/apisix/templates/configmap.yaml
@@ -28,276 +28,552 @@ data:
   {{- include "apisix.tplvalues.render" (dict "value" $value "context" $) 
| nindent 6 }}
 {{- end }}
 {{- else }}
-  config.yaml: |-
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-apisix:
-  node_listen: {{ .Values.gateway.http.containerPort }} # 
APISIX listening port
-  enable_heartbeat: true
-  enable_admin: {{ .Values.admin.enabled }}
-  enable_admin_cors: {{ .Values.admin.cors }}
-  enable_debug: false
-  {{- if or .Values.customPlugins.enabled 
.Values.apisix.luaModuleHook.enabled }}
-  extra_lua_path: {{ .Values.customPlugins.luaPath }};{{ 
.Values.apisix.luaModuleHook.luaPath }}
-  {{- end }}
-
-  {{- if .Values.apisix.luaModuleHook.enabled }}
-  lua_module_hook: {{ .Values.apisix.luaModuleHook.hookPoint | quote }}
-  {{- end }}
+  {{- if semverCompare ">=2.99.0" .Values.apisix.image.tag }}
+config.yaml: |-
+  #
+  # Licensed to the Apache Software Foundation (ASF) under one or more
+  # contributor license agreements.  See the NOTICE file distributed with
+  # this work for additional information regarding copyright ownership.
+  # The ASF licenses this file to You under the Apache License, Version 2.0
+  # (the "License"); you may not use this file except in compliance with
+  # the License.  You may obtain a copy of the License at
+  #
+  # http://www.apache.org/licenses/LICENSE-2.0
+  #
+  # Unless required by applicable law or agreed to in writing, software
+  # distributed under the License is distributed on an "AS IS" BASIS,
+  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
implied.
+  # See the License for the specific language governing permissions and
+  # limitations under the License.
+  #
+  apisix:
+node_listen: {{ .Values.gateway.http.containerPort }} # 
APISIX listening port
+enable_heartbeat: true
+enable_admin: {{ .Values.admin.enabled }}
+enable_admin_cors: {{ .Values.admin.cors }}
+enable_debug: false
+{{- if or .Values.customPlugins.enabled 
.Values.apisix.luaModuleHook.enabled }}
+extra_lua_path: {{ .Values.customPlugins.luaPath }};{{ 
.Values.apisix.luaModuleHook.luaPath }}
+{{- end }}
 
-  enable_dev_mode: false   # Sets nginx 
worker_processes to 1 if set to true
-  enable_reuseport: true   # Enable nginx SO_REUSEPORT 
switch if set to true.
-  enable_ipv6: {{ .Values.apisix.enableIPv6 }} # Enable nginx IPv6 resolver
-  enable_server_tokens: {{ .Values.apisix.enableServerTokens }} # Whether 
the APISIX version number should be shown in Server header
-  config_center: etcd  # etcd: use etcd to store 
the config value
-   # yaml: fetch the config 
value from local yaml file `/your_path/conf/apisix.yaml`
+{{- if .Values.apisix.luaModuleHook.enabled }}
+lua_module_hook: {{ .Values.apisix.luaModuleHook.hookPoint | quote }}
+{{- end }}
 
-  #proxy_protocol: # Proxy Protocol configuration
-  #  list

[apisix-java-plugin-runner] branch main updated: feat: support for getting upstream response body (#200)

2022-10-09 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new d5421c2  feat: support for getting upstream response body (#200)
d5421c2 is described below

commit d5421c292ef0d0ea93fb484afef668d7e2fc8767
Author: tzssangglass 
AuthorDate: Sun Oct 9 17:00:42 2022 +0800

feat: support for getting upstream response body (#200)
---
 ci/apisix/config.yaml  |  33 +++---
 ci/docker-compose.yml  |   1 -
 docs/en/latest/development.md  |   1 +
 docs/en/latest/installation-guide.md   |   2 +-
 .../plugin/runner/handler/RpcCallHandler.java  | 130 ++---
 runner-plugin-sdk/pom.xml  |   2 +-
 .../apisix/plugin/runner/ExtraInfoRequest.java |  12 +-
 .../apache/apisix/plugin/runner/PostRequest.java   |  24 
 .../apisix/plugin/runner/filter/PluginFilter.java  |   9 ++
 .../runner/filter/PostReqWithVarsFilter.java   |  75 
 tests/e2e/plugins/plugins_post_with_vars_test.go   |  78 +
 11 files changed, 302 insertions(+), 65 deletions(-)

diff --git a/ci/apisix/config.yaml b/ci/apisix/config.yaml
index 9f480de..a956ec2 100644
--- a/ci/apisix/config.yaml
+++ b/ci/apisix/config.yaml
@@ -15,23 +15,22 @@
 # limitations under the License.
 #
 
-
-apisix:
-  allow_admin:
-- 0.0.0.0/0
-  enable_control: true
-  control:
-ip: "0.0.0.0"
-port: 9092
-  admin_key:
-- name: admin
-  key: edd1c9f034335f136f87ad84b625c8f1
-  role: admin
-etcd:
-   host:
- - http://etcd:2379
-   prefix: "/apisix"
-   timeout: 30
+deployment:
+  role: traditional
+  role_traditional:
+config_provider: etcd
+  admin:
+admin_key:
+  - name: admin
+key: edd1c9f034335f136f87ad84b625c8f1  # using fixed API token has 
security risk, please update it when you deploy to production environment
+role: admin
+allow_admin:
+  - 0.0.0.0/0
+  etcd:
+host:
+  - "http://etcd:2379";
+prefix: "/apisix"
+timeout: 30
 ext-plugin:
   path_for_test: /tmp/runner.sock
 nginx_config:
diff --git a/ci/docker-compose.yml b/ci/docker-compose.yml
index b0da709..ddbbc63 100644
--- a/ci/docker-compose.yml
+++ b/ci/docker-compose.yml
@@ -31,7 +31,6 @@ services:
   - "9180:9180/tcp"
   - "9091:9091/tcp"
   - "9443:9443/tcp"
-  - "9092:9092/tcp"
 networks:
   apisix:
 
diff --git a/docs/en/latest/development.md b/docs/en/latest/development.md
index 567701d..91800fb 100644
--- a/docs/en/latest/development.md
+++ b/docs/en/latest/development.md
@@ -159,6 +159,7 @@ and you can also set the `PostResponse` to override the 
origin upstream response
 * request.getConfig()
 * request.getUpstreamHeaders()
 * request.getUpstreamStatusCode()
+* request.getBody()
 
 # PostResponse
 
diff --git a/docs/en/latest/installation-guide.md 
b/docs/en/latest/installation-guide.md
index 1822b72..5a4b58c 100644
--- a/docs/en/latest/installation-guide.md
+++ b/docs/en/latest/installation-guide.md
@@ -34,7 +34,7 @@ Prerequisites
 -
 
 * JDK 11
-* APISIX 2.15.0
+* APISIX master branch
 * Refer to [Debug](how-it-works.md#debug)  to build the debug environment.
 
 Install
diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/RpcCallHandler.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/RpcCallHandler.java
index 94ebcd2..ed5ff04 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/RpcCallHandler.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/RpcCallHandler.java
@@ -57,6 +57,7 @@ public class RpcCallHandler extends 
SimpleChannelInboundHandler {
 private final Logger logger = 
LoggerFactory.getLogger(RpcCallHandler.class);
 
 private final static String EXTRA_INFO_REQ_BODY_KEY = "request_body";
+private final static String EXTRA_INFO_RESP_BODY_KEY = "response_body";
 
 private final Cache cache;
 
@@ -106,6 +107,62 @@ public class RpcCallHandler extends 
SimpleChannelInboundHandler {
 }
 }
 
+private Boolean[] fetchExtraInfo(ChannelHandlerContext ctx, 
PluginFilterChain chain) {
+// fetch the nginx variables
+Set varKeys = new HashSet<>();
+boolean requiredReqBody = false;
+boolean requiredVars = false;
+boolean requiredRespBody = false;
+
+for (PluginFilter filter : chain.getFilters()) {
+Collection vars = filter.requiredVars();
+if (!CollectionUtils.isEmpty(vars)) {
+varKeys.addAll(vars);
+requiredVars = true;
+}
+
+if (filter.requiredBody() != 

[apisix] branch release/2.10 updated: ci: backport some high version changes to make CI pass

2022-09-23 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch release/2.10
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/release/2.10 by this push:
 new 1c6cd3606 ci: backport some high version changes to make CI pass
1c6cd3606 is described below

commit 1c6cd360681579b4f7864cd83cde6ab44fb00289
Author: tzssangglass 
AuthorDate: Fri Sep 23 18:03:37 2022 +0800

ci: backport some high version changes to make CI pass
---
 .github/actions/action-tmate  |  1 -
 .github/workflows/build.yml   |  2 +-
 .github/workflows/chaos.yml   | 11 ++
 .github/workflows/fuzzing-ci.yaml |  2 ++
 .gitmodules   |  3 --
 t/chaos/utils/Dockerfile  | 75 +++
 6 files changed, 80 insertions(+), 14 deletions(-)

diff --git a/.github/actions/action-tmate b/.github/actions/action-tmate
deleted file mode 16
index 079a16b22..0
--- a/.github/actions/action-tmate
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 079a16b22b8bcc5dd231a42d9a5e8e48db564688
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index eaca2428f..ff2f8d7d0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -20,7 +20,7 @@ jobs:
   fail-fast: false
   matrix:
 platform:
-  - ubuntu-18.04
+  - ubuntu-20.04
 os_name:
   - linux_openresty
   - linux_openresty_1_17
diff --git a/.github/workflows/chaos.yml b/.github/workflows/chaos.yml
index c83787037..df9e3d56d 100644
--- a/.github/workflows/chaos.yml
+++ b/.github/workflows/chaos.yml
@@ -21,7 +21,7 @@ jobs:
   - name: Setup go
 uses: actions/setup-go@v2.1.4
 with:
-  go-version: "1.16"
+  go-version: "1.17"
 
   - uses: actions/cache@v2
 with:
@@ -35,9 +35,8 @@ jobs:
   - name: Creating minikube cluster
 run: |
   bash ./t/chaos/utils/setup_chaos_utils.sh start_minikube
-  wget 
https://raw.githubusercontent.com/apache/apisix-docker/master/alpine-local/Dockerfile
   mkdir logs
-  docker build -t apache/apisix:alpine-local --build-arg APISIX_PATH=. 
-f Dockerfile .
+  docker build -t apache/apisix:alpine-local --build-arg APISIX_PATH=. 
-f ./t/chaos/utils/Dockerfile .
   minikube cache add apache/apisix:alpine-local -v 7 --alsologtostderr
 
   - name: Print cluster information
@@ -80,9 +79,3 @@ jobs:
   - name: Run test
 working-directory: ./t/chaos
 run: ginkgo -r --v --progress --trace
-
-  # Debug via SSH if previous steps failed
-  - name: Set up tmate session
-if: ${{ failure() }}
-uses: ./.github/actions/action-tmate
-timeout-minutes: 15
diff --git a/.github/workflows/fuzzing-ci.yaml 
b/.github/workflows/fuzzing-ci.yaml
index 20d393f89..b252b19e4 100644
--- a/.github/workflows/fuzzing-ci.yaml
+++ b/.github/workflows/fuzzing-ci.yaml
@@ -63,6 +63,8 @@ jobs:
 
 - name: install boofuzz
   run: |
+# Avoid "ERROR: flask has requirement click>=8.0, but you'll have 
click 7.0 which is incompatible"
+sudo apt remove python3-click
 pip install -r $PWD/t/fuzzing/requirements.txt
 
 - name: run simpleroute test
diff --git a/.gitmodules b/.gitmodules
index 78dcdd805..beb354b89 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,3 @@
 [submodule "t/toolkit"]
path = t/toolkit
url = https://github.com/api7/test-toolkit.git
-[submodule ".github/actions/action-tmate"]
-   path = .github/actions/action-tmate
-   url = https://github.com/mxschmitt/action-tmate
diff --git a/t/chaos/utils/Dockerfile b/t/chaos/utils/Dockerfile
new file mode 100644
index 0..700108283
--- /dev/null
+++ b/t/chaos/utils/Dockerfile
@@ -0,0 +1,75 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ARG ENABLE_PROXY=false
+
+FROM openresty/openresty:1.19.3.2-alpine-fat AS production-stage
+
+ARG ENABLE_PROXY
+ARG APISIX_PATH
+COPY $APISIX_PATH ./apisix
+RUN set -x \
+&& (test "${ENABLE_PROX

[apisix] branch release/2.10 updated: fix: use modifiedIndex as lru key when merge plugins from route and consumer (#7967)

2022-09-22 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch release/2.10
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/release/2.10 by this push:
 new 742180779 fix: use modifiedIndex as lru key when merge plugins from 
route and consumer (#7967)
742180779 is described below

commit 74218077998d5769beab02fee3422f240e86b235
Author: tzssangglass 
AuthorDate: Thu Sep 22 18:28:08 2022 +0800

fix: use modifiedIndex as lru key when merge plugins from route and 
consumer (#7967)
---
 apisix/consumer.lua   |   1 +
 apisix/plugin.lua |   4 +-
 t/node/consumer-plugin2.t | 178 ++
 t/node/plugin-configs.t   | 102 ++
 4 files changed, 283 insertions(+), 2 deletions(-)

diff --git a/apisix/consumer.lua b/apisix/consumer.lua
index 9a4dc3c42..5e25b7521 100644
--- a/apisix/consumer.lua
+++ b/apisix/consumer.lua
@@ -56,6 +56,7 @@ local function plugin_consumer()
 -- is 'username' field in admin
 new_consumer.consumer_name = new_consumer.id
 new_consumer.auth_conf = config
+new_consumer.modifiedIndex = consumer.modifiedIndex
 core.log.info("consumer:", 
core.json.delay_encode(new_consumer))
 core.table.insert(plugins[name].nodes, new_consumer)
 end
diff --git a/apisix/plugin.lua b/apisix/plugin.lua
index 7139a0b7a..f3622580b 100644
--- a/apisix/plugin.lua
+++ b/apisix/plugin.lua
@@ -27,7 +27,6 @@ local pairs = pairs
 local type  = type
 local local_plugins = core.table.new(32, 0)
 local ngx   = ngx
-local tostring  = tostring
 local error = error
 local is_http   = ngx.config.subsystem == "http"
 local local_plugins_hash= core.table.new(0, 32)
@@ -474,7 +473,8 @@ function _M.merge_consumer_route(route_conf, consumer_conf, 
api_ctx)
 core.log.info("route conf: ", core.json.delay_encode(route_conf))
 core.log.info("consumer conf: ", core.json.delay_encode(consumer_conf))
 
-local flag = tostring(route_conf) .. tostring(consumer_conf)
+local flag = route_conf.value.id .. "#" .. route_conf.modifiedIndex
+ .. "#" .. consumer_conf.id .. "#" .. 
consumer_conf.modifiedIndex
 local new_conf = merged_route(flag, nil,
 merge_consumer_route, route_conf, consumer_conf)
 
diff --git a/t/node/consumer-plugin2.t b/t/node/consumer-plugin2.t
new file mode 100644
index 0..81d624e91
--- /dev/null
+++ b/t/node/consumer-plugin2.t
@@ -0,0 +1,178 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+use t::APISIX 'no_plan';
+
+log_level('info');
+repeat_each(1);
+no_long_string();
+no_root_location();
+
+add_block_preprocessor(sub {
+my ($block) = @_;
+
+if (!$block->request) {
+$block->set_value("request", "GET /t");
+}
+
+if (!$block->response_body) {
+$block->set_value("response_body", "passed\n");
+}
+
+if (!$block->no_error_log && !$block->error_log) {
+$block->set_value("no_error_log", "[error]\n[alert]");
+}
+});
+
+
+our $debug_config = t::APISIX::read_file("conf/debug.yaml");
+$debug_config =~ s/basic:\n  enable: false/basic:\n  enable: true/;
+$debug_config =~ s/hook_conf:\n  enable: false/hook_conf:\n  enable: true/;
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: use the latest consumer modifiedIndex as lrucache key
+--- config
+location /t {
+content_by_lua_block {
+local t = require("lib.test_admin").test
+local code, body = t('/apisix/admin/consumers',
+ngx.HTTP_PUT,
+[[{
+"username": "foo",
+"plugins": {
+"basic-auth": {
+"username": "foo",
+"passwo

[apisix] branch master updated: fix: use modifiedIndex as lru key when merge plugins from route and consumer (#7965)

2022-09-22 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new a47d05a9a fix: use modifiedIndex as lru key when merge plugins from 
route and consumer (#7965)
a47d05a9a is described below

commit a47d05a9a32db1ba7de6bda68c67cf0008f8442c
Author: tzssangglass 
AuthorDate: Thu Sep 22 15:15:56 2022 +0800

fix: use modifiedIndex as lru key when merge plugins from route and 
consumer (#7965)
---
 apisix/consumer.lua   |   1 +
 apisix/plugin.lua |   3 +-
 t/node/consumer-plugin2.t | 132 ++
 t/node/plugin-configs.t   | 102 +++
 4 files changed, 237 insertions(+), 1 deletion(-)

diff --git a/apisix/consumer.lua b/apisix/consumer.lua
index 9a4dc3c42..5e25b7521 100644
--- a/apisix/consumer.lua
+++ b/apisix/consumer.lua
@@ -56,6 +56,7 @@ local function plugin_consumer()
 -- is 'username' field in admin
 new_consumer.consumer_name = new_consumer.id
 new_consumer.auth_conf = config
+new_consumer.modifiedIndex = consumer.modifiedIndex
 core.log.info("consumer:", 
core.json.delay_encode(new_consumer))
 core.table.insert(plugins[name].nodes, new_consumer)
 end
diff --git a/apisix/plugin.lua b/apisix/plugin.lua
index 3cf2283a9..7c26ac4d7 100644
--- a/apisix/plugin.lua
+++ b/apisix/plugin.lua
@@ -655,7 +655,8 @@ function _M.merge_consumer_route(route_conf, consumer_conf, 
api_ctx)
 core.log.info("route conf: ", core.json.delay_encode(route_conf))
 core.log.info("consumer conf: ", core.json.delay_encode(consumer_conf))
 
-local flag = tostring(route_conf) .. tostring(consumer_conf)
+local flag = route_conf.value.id .. "#" .. route_conf.modifiedIndex
+ .. "#" .. consumer_conf.id .. "#" .. 
consumer_conf.modifiedIndex
 local new_conf = merged_route(flag, nil,
 merge_consumer_route, route_conf, consumer_conf)
 
diff --git a/t/node/consumer-plugin2.t b/t/node/consumer-plugin2.t
index c05762f40..64c3869bc 100644
--- a/t/node/consumer-plugin2.t
+++ b/t/node/consumer-plugin2.t
@@ -303,3 +303,135 @@ apikey: auth-jack
 --- error_code: 403
 --- response_body
 {"message":"Your IP address is not allowed"}
+
+
+
+=== TEST 9: use the latest consumer modifiedIndex as lrucache key
+--- config
+location /t {
+content_by_lua_block {
+local t = require("lib.test_admin").test
+local code, body = t('/apisix/admin/consumers',
+ngx.HTTP_PUT,
+[[{
+"username": "foo",
+"plugins": {
+"basic-auth": {
+"username": "foo",
+"password": "bar"
+}
+}
+}]]
+)
+if code >= 300 then
+ngx.status = code
+ngx.say(body)
+return
+end
+
+local code, body = t('/apisix/admin/plugin_configs/1',
+ngx.HTTP_PUT,
+[[{
+"plugins": {
+"ip-restriction": {
+"whitelist": ["1.1.1.1"]
+},
+"basic-auth": {}
+}
+}]]
+)
+if code >= 300 then
+ngx.status = code
+ngx.say(body)
+return
+end
+
+local code, body = t('/apisix/admin/routes/1',
+ngx.HTTP_PUT,
+[[{
+"plugin_config_id": "1",
+"upstream": {
+"nodes": {
+"127.0.0.1:1980": 1
+},
+"type": "roundrobin"
+},
+"uris": ["/hello"]
+}]]
+)
+if code >= 300 then
+ngx.status = code
+ngx.say(body)
+return
+end
+ngx.sleep(0.5)
+
+local http = require "resty.http"
+local httpc = http.new()
+local uri = "http://127.0.0.1:"; .. ngx.var.server_port
+.. "/hello"
+local headers = {
+["Authori

[apisix] branch master updated: test: fix broken test introduced in #7926 (#7959)

2022-09-21 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new efd5d1ec2 test: fix broken test introduced in #7926 (#7959)
efd5d1ec2 is described below

commit efd5d1ec21cd1a756eaba345fe2357e54a2b721a
Author: 罗泽轩 
AuthorDate: Wed Sep 21 17:08:57 2022 +0800

test: fix broken test introduced in #7926 (#7959)
---
 t/cli/test_admin.sh   | 2 +-
 t/config-center-yaml/plugin.t | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/t/cli/test_admin.sh b/t/cli/test_admin.sh
index f71f7fca2..5336244e3 100755
--- a/t/cli/test_admin.sh
+++ b/t/cli/test_admin.sh
@@ -347,7 +347,7 @@ if ! grep -E 'new plugins: 
{"public-api":true,"node-status":true}' logs/error.lo
 fi
 
 # check stream plugins(no plugins under stream, it will be added below)
-if ! grep -E 'failed to read stream plugin list from local file' 
logs/error.log; then
+if grep -E 'failed to read stream plugin list from local file' logs/error.log; 
then
 echo "failed: first time load stream plugins list failed"
 exit 1
 fi
diff --git a/t/config-center-yaml/plugin.t b/t/config-center-yaml/plugin.t
index dabda82a2..cc9a6ea4e 100644
--- a/t/config-center-yaml/plugin.t
+++ b/t/config-center-yaml/plugin.t
@@ -223,7 +223,6 @@ GET /t
 --- response_body
 hello world
 --- error_log
-use config_center: yaml
 grep_error_log_out
+use config_provider: yaml
 load(): new plugins: {}
 load_stream(): new plugins: {}



[apisix-java-plugin-runner] branch main updated: docs: remove "experimental" from the STATUS section (#196)

2022-09-01 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new d2fe045  docs: remove "experimental" from the STATUS section (#196)
d2fe045 is described below

commit d2fe045624fad0b7162b11b8acf836d724f870ea
Author: Qi Guo <979918...@qq.com>
AuthorDate: Fri Sep 2 14:27:00 2022 +0800

docs: remove "experimental" from the STATUS section (#196)

Co-authored-by: 琚致远 
---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 01deb33..b680d2a 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ Implemented as a sidecar that accompanies APISIX.
 Status
 --
 
-This project is currently considered experimental.
+This project is generally available.
 
 Why apisix-java-plugin-runner
 -
@@ -54,4 +54,4 @@ in your own environment.
 License
 ---
 
-[Apache 2.0 LICENSE](./LICENSE)
\ No newline at end of file
+[Apache 2.0 LICENSE](./LICENSE)



[apisix-docker] branch master updated: chore: install apisix via package name instead of url (#344)

2022-09-01 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git


The following commit(s) were added to refs/heads/master by this push:
 new 52f7a0c  chore: install apisix via package name instead of url (#344)
52f7a0c is described below

commit 52f7a0c135422bad1b58c0691accb61d751da0ee
Author: soulbird 
AuthorDate: Fri Sep 2 14:20:49 2022 +0800

chore: install apisix via package name instead of url (#344)

Co-authored-by: soulbird 
---
 centos/Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/centos/Dockerfile b/centos/Dockerfile
index c48184c..9825227 100644
--- a/centos/Dockerfile
+++ b/centos/Dockerfile
@@ -21,7 +21,7 @@ ARG APISIX_VERSION=2.15.0
 LABEL apisix_version="${APISIX_VERSION}"
 
 RUN yum install -y 
https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm \
-   && yum install -y 
https://repos.apiseven.com/packages/centos/7/x86_64/apisix-$APISIX_VERSION-0.el7.x86_64.rpm
 \
+   && yum install -y apisix-${APISIX_VERSION} \
&& yum clean all \
&& sed -i 's/PASS_MAX_DAYS\t9/PASS_MAX_DAYS\t60/g' /etc/login.defs
 



[apisix-java-plugin-runner] branch main updated: ci: sync APISIX use 9180 as default port of admin API (#197)

2022-09-01 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 88e341e  ci: sync APISIX use 9180 as default port of admin API (#197)
88e341e is described below

commit 88e341e52a5ffba02f41763855b75b3755937da5
Author: tzssangglass 
AuthorDate: Fri Sep 2 11:03:02 2022 +0800

ci: sync APISIX use 9180 as default port of admin API (#197)
---
 ci/docker-compose.yml |  1 +
 tests/e2e/plugins/plugins_post_test.go|  2 +-
 tests/e2e/plugins/plugins_rewrite_test.go |  2 +-
 tests/e2e/plugins/plugins_stop_test.go|  2 +-
 tests/e2e/tools/tools.go  | 12 +---
 5 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/ci/docker-compose.yml b/ci/docker-compose.yml
index b0c838a..b0da709 100644
--- a/ci/docker-compose.yml
+++ b/ci/docker-compose.yml
@@ -28,6 +28,7 @@ services:
   - etcd
 ports:
   - "9080:9080/tcp"
+  - "9180:9180/tcp"
   - "9091:9091/tcp"
   - "9443:9443/tcp"
   - "9092:9092/tcp"
diff --git a/tests/e2e/plugins/plugins_post_test.go 
b/tests/e2e/plugins/plugins_post_test.go
index 4e472c9..65731cf 100644
--- a/tests/e2e/plugins/plugins_post_test.go
+++ b/tests/e2e/plugins/plugins_post_test.go
@@ -32,7 +32,7 @@ var _ = ginkgo.Describe("Post", func() {
tools.RunTestCase(tc)
},
table.Entry("create java runner post plugin route success", 
tools.HttpTestCase{
-   Object: tools.GetA6Expect(),
+   Object: tools.PutA6Conf(),
Method: http.MethodPut,
Path:   "/apisix/admin/routes/1",
Body: `{
diff --git a/tests/e2e/plugins/plugins_rewrite_test.go 
b/tests/e2e/plugins/plugins_rewrite_test.go
index a6d2c8d..3f1be85 100644
--- a/tests/e2e/plugins/plugins_rewrite_test.go
+++ b/tests/e2e/plugins/plugins_rewrite_test.go
@@ -31,7 +31,7 @@ var _ = ginkgo.Describe("Stop", func() {
tools.RunTestCase(tc)
},
table.Entry("create java runner stop plugin route success", 
tools.HttpTestCase{
-   Object: tools.GetA6Expect(),
+   Object: tools.PutA6Conf(),
Method: http.MethodPut,
Path:   "/apisix/admin/routes/1",
Body: `{
diff --git a/tests/e2e/plugins/plugins_stop_test.go 
b/tests/e2e/plugins/plugins_stop_test.go
index 87ea5dc..16f7e70 100644
--- a/tests/e2e/plugins/plugins_stop_test.go
+++ b/tests/e2e/plugins/plugins_stop_test.go
@@ -32,7 +32,7 @@ var _ = ginkgo.Describe("Stop", func() {
tools.RunTestCase(tc)
},
table.Entry("create java runner stop plugin route success", 
tools.HttpTestCase{
-   Object: tools.GetA6Expect(),
+   Object: tools.PutA6Conf(),
Method: http.MethodPut,
Path:   "/apisix/admin/routes/1",
Body: `{
diff --git a/tests/e2e/tools/tools.go b/tests/e2e/tools/tools.go
index 064d93b..b657c82 100644
--- a/tests/e2e/tools/tools.go
+++ b/tests/e2e/tools/tools.go
@@ -26,17 +26,23 @@ import (
 )
 
 var (
-   token  = "edd1c9f034335f136f87ad84b625c8f1"
-   A6Host = "http://127.0.0.1:9080";
+   token  = "edd1c9f034335f136f87ad84b625c8f1"
+   A6_CP_Host = "http://127.0.0.1:9180";
+   A6_DP_Host = "http://127.0.0.1:9080";
 )
 
 func GetAdminToken() string {
return token
 }
 
+func PutA6Conf() *httpexpect.Expect {
+   t := ginkgo.GinkgoT()
+   return httpexpect.New(t, A6_CP_Host)
+}
+
 func GetA6Expect() *httpexpect.Expect {
t := ginkgo.GinkgoT()
-   return httpexpect.New(t, A6Host)
+   return httpexpect.New(t, A6_DP_Host)
 }
 
 type HttpTestCase struct {



[apisix-java-plugin-runner] branch main updated: feat: update version to 0.3.1-SNAPSHOT (#194)

2022-08-28 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new cc0a102  feat: update version to 0.3.1-SNAPSHOT (#194)
cc0a102 is described below

commit cc0a10274620f15a438860e3f840eb151ad8a60c
Author: tzssangglass 
AuthorDate: Mon Aug 29 01:35:07 2022 +0800

feat: update version to 0.3.1-SNAPSHOT (#194)
---
 docs/en/latest/installation-guide.md   | 2 +-
 pom.xml| 2 +-
 runner-core/pom.xml| 4 ++--
 runner-dist/apisix-runner-bin-dist/pom.xml | 2 +-
 runner-dist/apisix-runner-src-dist/pom.xml | 2 +-
 runner-dist/pom.xml| 4 ++--
 runner-plugin-sdk/pom.xml  | 2 +-
 runner-plugin/pom.xml  | 4 ++--
 runner-starter/pom.xml | 4 ++--
 sample/pom.xml | 4 ++--
 10 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/docs/en/latest/installation-guide.md 
b/docs/en/latest/installation-guide.md
index 2579053..1822b72 100644
--- a/docs/en/latest/installation-guide.md
+++ b/docs/en/latest/installation-guide.md
@@ -48,7 +48,7 @@ Install
 
 org.apache.apisix 
 apisix-runner-starter
-0.3.0
+0.3.1-SNAPSHOT
 
 ```
 
diff --git a/pom.xml b/pom.xml
index 845fa0b..0d0ca54 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.0
+0.3.1-SNAPSHOT
   
 
 org.apache
diff --git a/runner-core/pom.xml b/runner-core/pom.xml
index 41bd98e..f61a739 100644
--- a/runner-core/pom.xml
+++ b/runner-core/pom.xml
@@ -24,7 +24,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.0
+0.3.1-SNAPSHOT
 
 
 apisix-runner-core
@@ -36,7 +36,7 @@
 
 org.apache.apisix
 apisix-runner-plugin-sdk
-0.3.0
+0.3.1-SNAPSHOT
 
 
 org.springframework.boot
diff --git a/runner-dist/apisix-runner-bin-dist/pom.xml 
b/runner-dist/apisix-runner-bin-dist/pom.xml
index 1c0f0c5..69505d2 100644
--- a/runner-dist/apisix-runner-bin-dist/pom.xml
+++ b/runner-dist/apisix-runner-bin-dist/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-runner-dist
-0.3.0
+0.3.1-SNAPSHOT
 
 
 apisix-runner-bin-dist
diff --git a/runner-dist/apisix-runner-src-dist/pom.xml 
b/runner-dist/apisix-runner-src-dist/pom.xml
index d3c2d91..a8b3ee6 100644
--- a/runner-dist/apisix-runner-src-dist/pom.xml
+++ b/runner-dist/apisix-runner-src-dist/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-runner-dist
-0.3.0
+0.3.1-SNAPSHOT
 
 
 apisix-runner-src-dist
diff --git a/runner-dist/pom.xml b/runner-dist/pom.xml
index a092b1e..558b3b5 100644
--- a/runner-dist/pom.xml
+++ b/runner-dist/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.0
+0.3.1-SNAPSHOT
 
 
 apisix-runner-dist
@@ -35,7 +35,7 @@
 
 org.apache.apisix
 apisix-runner-starter
-0.3.0
+0.3.1-SNAPSHOT
 
 
 
diff --git a/runner-plugin-sdk/pom.xml b/runner-plugin-sdk/pom.xml
index 7554648..e72831f 100644
--- a/runner-plugin-sdk/pom.xml
+++ b/runner-plugin-sdk/pom.xml
@@ -24,7 +24,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.0
+0.3.1-SNAPSHOT
 
 
 apisix-runner-plugin-sdk
diff --git a/runner-plugin/pom.xml b/runner-plugin/pom.xml
index f0fba48..5e1b2f0 100644
--- a/runner-plugin/pom.xml
+++ b/runner-plugin/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.0
+0.3.1-SNAPSHOT
 
 
 apisix-runner-plugin
@@ -35,7 +35,7 @@
 
 org.apache.apisix
 apisix-runner-plugin-sdk
-0.3.0
+0.3.1-SNAPSHOT
 
 
 com.google.code.gson
diff --git a/runner-starter/pom.xml b/runner-starter/pom.xml
index 90fa035..0526bf3 100644
--- a/runner-starter/pom.xml
+++ b/runner-starter/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.0
+0.3.1-SNAPSHOT
 
 
 apisix-runner-starter
@@ -35,7 +35,7 @@
 
 org.apache.apisix
 apisix-runner-core
-0.3.0
+0.3.1-SNAPSHOT
 
 
 
diff --git a/sample/pom.xml b/sample/pom.xml
index f40a230..013de5e 100644
--- a/sample/pom.xml
+++ b/sample/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.0
+0.3.1-SNAPSHOT
 
 
 apisix-runner-sample
@@ -35,7 +35,7 @@
 
 org.apache.apisix
 apisix-runner-plugin

[apisix-java-plugin-runner] branch main updated (0790d33 -> f2437ee)

2022-08-28 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


from 0790d33  docs: update MAINTAIN.md (#187)
 add f2437ee  chore: fix missing parent project on deploy (#193)

No new revisions were added by this update.

Summary of changes:
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[apisix-java-plugin-runner] branch main updated: docs: update MAINTAIN.md (#187)

2022-08-18 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 0790d33  docs: update MAINTAIN.md (#187)
0790d33 is described below

commit 0790d338a2b767c40afc79d7dfe67d9a6a10298d
Author: tzssangglass 
AuthorDate: Fri Aug 19 14:09:44 2022 +0800

docs: update MAINTAIN.md (#187)
---
 MAINTAIN.md | 19 +--
 Makefile| 10 +-
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/MAINTAIN.md b/MAINTAIN.md
index 5cf7f66..63f6ca9 100644
--- a/MAINTAIN.md
+++ b/MAINTAIN.md
@@ -26,9 +26,16 @@ Project Maintenance
 Apache projects release all software packages through the ASF distribution 
system. 
 
 1. Set up your development environment. For more details, see the [Publishing 
Maven Releases to Maven Central 
Repository](https://infra.apache.org/publishing-maven-artifacts.html).
-
-2. Deploy the snapshot artifacts to Apache Nexus
-
-```shell
-make deploy
-```
+2. Create a release PR, the release PR (e.g.: 
https://github.com/apache/apisix-java-plugin-runner/pull/183) should do the 
following:
+   - contains the changelog
+   - contains version change(remove `SNAPSHOT` suffix)
+3. After the release PR merged, create a branch named `release/` form 
`main` branch
+4. Execute `make release-src` to build vote artifact, package the vote 
artifact to Apache's dev-apisix repo
+5. When the vote is passed, Send the [vote 
email](https://lists.apache.org/thread/721kfy9yqp4cm5cokg4yydczxgr08nbq) to 
d...@apisix.apache.org
+6. When the vote is passed, send the [vote result 
email](https://lists.apache.org/thread/ky55hf5swklb880x3tf3rdwfj5wyt1hs) to 
d...@apisix.apache.org
+7. Move the vote artifact to Apache's apisix repo
+8. Register the release info in 
https://reporter.apache.org/addrelease.html?apisix
+9. Checkout the release branch, execute `make deploy` to deploy the release 
artifact to Apache's apisix repo
+10. Create a [GitHub 
release](https://github.com/apache/apisix-java-plugin-runner/releases/tag/0.3.0)
 from the release branch
+11. Update [APISIX's 
website](https://github.com/apache/apisix-website/pull/1295)
+12. Send the [ANNOUNCE 
email](https://lists.apache.org/thread/4s4msqwl1tq13p9dnv3hx7skbgpkozw1) to 
d...@apisix.apache.org & annou...@apache.org
diff --git a/Makefile b/Makefile
index d5766b6..12198f8 100644
--- a/Makefile
+++ b/Makefile
@@ -22,13 +22,13 @@ RELEASE_SRC = apisix-java-plugin-runner-${VERSION}-src
 
 .PHONY: release-src
 release-src: compress-tar
-   gpg --batch --yes --armor --detach-sig ./$(RELEASE_SRC).tgz
-   shasum -a 512 ./$(RELEASE_SRC).tgz > ./$(RELEASE_SRC).tgz.sha512
+   cd dist && gpg --batch --yes --armor --detach-sig ./$(RELEASE_SRC).tgz
+   cd dist && shasum -a 512 ./$(RELEASE_SRC).tgz > 
./$(RELEASE_SRC).tgz.sha512
 
mkdir -p release
-   mv ./$(RELEASE_SRC).tgz release/$(RELEASE_SRC).tgz
-   mv ./$(RELEASE_SRC).tgz.asc release/$(RELEASE_SRC).tgz.asc
-   mv ./$(RELEASE_SRC).tgz.sha512 release/$(RELEASE_SRC).tgz.sha512
+   mv ./dist/$(RELEASE_SRC).tgz ./release/$(RELEASE_SRC).tgz
+   mv ./dist/$(RELEASE_SRC).tgz.asc ./release/$(RELEASE_SRC).tgz.asc
+   mv ./dist/$(RELEASE_SRC).tgz.sha512 ./release/$(RELEASE_SRC).tgz.sha512
 
 .PHONY: compress-tar
 compress-tar:



[apisix-java-plugin-runner] tag 0.3.0 created (now 4d6180b)

2022-08-18 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to tag 0.3.0
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


  at 4d6180b  (commit)
No new revisions were added by this update.



[apisix-java-plugin-runner] branch release/0.3.0 created (now 4d6180b)

2022-08-18 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/0.3.0
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


  at 4d6180b  docs: fix file name (#185)

No new revisions were added by this update.



[apisix-java-plugin-runner] branch main updated: docs: fix file name (#185)

2022-08-15 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 4d6180b  docs: fix file name (#185)
4d6180b is described below

commit 4d6180b3de3e6ae0980e1b95a808d46ba48362db
Author: Navendu Pottekkat 
AuthorDate: Mon Aug 15 13:16:50 2022 +0530

docs: fix file name (#185)
---
 docs/en/latest/config.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/en/latest/config.json b/docs/en/latest/config.json
index 4ecf626..fefb1ee 100644
--- a/docs/en/latest/config.json
+++ b/docs/en/latest/config.json
@@ -23,7 +23,7 @@
   },
   {
 "type": "doc",
-"id": "hot-reload"
+"id": "hot-reloading"
   }
 ]
   }



[apisix-java-plugin-runner] branch main updated: feat: release 0.3.0 (#183)

2022-08-11 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 5f9a418  feat: release 0.3.0 (#183)
5f9a418 is described below

commit 5f9a418ba0c56feb437d6194be54bba1b954677a
Author: tzssangglass 
AuthorDate: Fri Aug 12 14:50:51 2022 +0800

feat: release 0.3.0 (#183)
---
 CHANGELOG.md   | 14 ++
 Makefile   |  2 +-
 pom.xml|  2 +-
 runner-core/pom.xml|  4 ++--
 runner-dist/apisix-runner-bin-dist/pom.xml |  2 +-
 runner-dist/apisix-runner-src-dist/pom.xml |  2 +-
 runner-dist/pom.xml|  4 ++--
 runner-plugin-sdk/pom.xml  |  2 +-
 runner-plugin/pom.xml  |  4 ++--
 runner-starter/pom.xml |  4 ++--
 sample/pom.xml |  4 ++--
 11 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 430164e..941ba3b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,9 +23,23 @@ title: Changelog
 
 ## Table of Contents
 
+- [0.3.0](#030)
 - [0.2.0](#020)
 - [0.1.0](#010)
 
+## 0.3.0
+
+This release mainly provides the ability to get headers from upstream, and 
support download the project from Maven Center.
+
+### Change
+
+- rename the name of the function that gets all the headers. 
[132](https://github.com/apache/apisix-java-plugin-runner/pull/132)
+
+### Core
+
+- support filter upstream response headers. 
[164](https://github.com/apache/apisix-java-plugin-runner/pull/164)
+- support hot reload of plugin filters. 
[158](https://github.com/apache/apisix-java-plugin-runner/pull/158)
+
 ## 0.2.0
 
 This release mainly provides the ability to get variables and request body.
diff --git a/Makefile b/Makefile
index 6388a61..d5766b6 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
 
 SHELL := /bin/bash -o pipefail
 
-VERSION ?= 0.3.0-SNAPSHOT
+VERSION ?= 0.3.0
 RELEASE_SRC = apisix-java-plugin-runner-${VERSION}-src
 
 .PHONY: release-src
diff --git a/pom.xml b/pom.xml
index 50d97a8..845fa0b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.0-SNAPSHOT
+0.3.0
   
 
 org.apache
diff --git a/runner-core/pom.xml b/runner-core/pom.xml
index aaeaede..41bd98e 100644
--- a/runner-core/pom.xml
+++ b/runner-core/pom.xml
@@ -24,7 +24,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.0-SNAPSHOT
+0.3.0
 
 
 apisix-runner-core
@@ -36,7 +36,7 @@
 
 org.apache.apisix
 apisix-runner-plugin-sdk
-0.3.0-SNAPSHOT
+0.3.0
 
 
 org.springframework.boot
diff --git a/runner-dist/apisix-runner-bin-dist/pom.xml 
b/runner-dist/apisix-runner-bin-dist/pom.xml
index 48043e3..1c0f0c5 100644
--- a/runner-dist/apisix-runner-bin-dist/pom.xml
+++ b/runner-dist/apisix-runner-bin-dist/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-runner-dist
-0.3.0-SNAPSHOT
+0.3.0
 
 
 apisix-runner-bin-dist
diff --git a/runner-dist/apisix-runner-src-dist/pom.xml 
b/runner-dist/apisix-runner-src-dist/pom.xml
index ab817be..d3c2d91 100644
--- a/runner-dist/apisix-runner-src-dist/pom.xml
+++ b/runner-dist/apisix-runner-src-dist/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-runner-dist
-0.3.0-SNAPSHOT
+0.3.0
 
 
 apisix-runner-src-dist
diff --git a/runner-dist/pom.xml b/runner-dist/pom.xml
index f2e9bdf..a092b1e 100644
--- a/runner-dist/pom.xml
+++ b/runner-dist/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.0-SNAPSHOT
+0.3.0
 
 
 apisix-runner-dist
@@ -35,7 +35,7 @@
 
 org.apache.apisix
 apisix-runner-starter
-0.3.0-SNAPSHOT
+0.3.0
 
 
 
diff --git a/runner-plugin-sdk/pom.xml b/runner-plugin-sdk/pom.xml
index b52133f..7554648 100644
--- a/runner-plugin-sdk/pom.xml
+++ b/runner-plugin-sdk/pom.xml
@@ -24,7 +24,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.0-SNAPSHOT
+0.3.0
 
 
 apisix-runner-plugin-sdk
diff --git a/runner-plugin/pom.xml b/runner-plugin/pom.xml
index 9bffaf2..f0fba48 100644
--- a/runner-plugin/pom.xml
+++ b/runner-plugin/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.3.0-SNAPSHOT
+0.3.0
 
 
 apisix-runner-plugin
@@ -35,7 +35,7 @@
 
 org.apache.apisix
 apisix-runner-plugin-sdk
-0.3.0-SNAPSHOT
+0.3.0
 
 
 com.google.code.gson
diff --git

[apisix-java-plugin-runner] branch main updated: docs: refactor multiple documentation structures (#182)

2022-08-11 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 93ba186  docs: refactor multiple documentation structures (#182)
93ba186 is described below

commit 93ba1862295ac1f0f96d6124581a9d82325b15c6
Author: tzssangglass 
AuthorDate: Thu Aug 11 15:26:01 2022 +0800

docs: refactor multiple documentation structures (#182)
---
 README.md|   1 +
 docs/en/latest/config.json   |  12 +++
 docs/en/latest/deployment-guide.md   |  61 
 docs/en/latest/development.md|  33 +--
 docs/en/latest/hot-reloading.md  |   4 +
 docs/en/latest/installation-guide.md | 111 ++
 docs/en/latest/writing-filters.md| 176 ---
 docs/zh/quick-start.md   |   2 +-
 8 files changed, 191 insertions(+), 209 deletions(-)

diff --git a/README.md b/README.md
index 0e18ca2..01deb33 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,7 @@ Version Matrix
 
|---|-|
 | 0.1.0 | >= 
[2.7.0](https://github.com/apache/apisix/blob/master/CHANGELOG.md#270)   |
 | 0.2.0 | >= 
[2.12.0](https://github.com/apache/apisix/blob/master/CHANGELOG.md#2102) |
+| 0.3.0 | >= 
[2.15.0](https://github.com/apache/apisix/blob/master/CHANGELOG.md#2150) |
 
 How it Works
 -
diff --git a/docs/en/latest/config.json b/docs/en/latest/config.json
index eb6af5a..4ecf626 100644
--- a/docs/en/latest/config.json
+++ b/docs/en/latest/config.json
@@ -12,6 +12,18 @@
   {
 "type": "doc",
 "id": "the-internal-of-apisix-java-plugin-runner"
+  },
+  {
+"type": "doc",
+"id": "installation-guide"
+  },
+  {
+"type": "doc",
+"id": "deployment-guide"
+  },
+  {
+"type": "doc",
+"id": "hot-reload"
   }
 ]
   }
diff --git a/docs/en/latest/deployment-guide.md 
b/docs/en/latest/deployment-guide.md
new file mode 100644
index 000..8143d88
--- /dev/null
+++ b/docs/en/latest/deployment-guide.md
@@ -0,0 +1,61 @@
+---
+title: Deployment Guide
+---
+
+
+
+# Overview
+
+This document explains how to support multiple ways to deploy custom plugins.
+
+:::note
+
+This feature is WIP.
+
+:::
+
+### Ship plugin
+
+In your plugin's `pom.xml`, add the following configuration:
+```
+
+
+
+org.springframework.boot
+spring-boot-maven-plugin
+
+exec
+
+
+
+
+```
+
+The standard Spring Boot executable JAR places all of your application classes 
inside *BOOT-INF/classes*, 
+making it impossible to inject into another project. This config builds an 
additional non-executable JAR 
+that can be used for dependency injection.
+
+Deploy the JARs to Maven Central.
+
+### Using a deployed plugin
+
+To use someone else's plugin, add their plugin's non-executable JAR as a 
dependency in your project. 
+Add the package name of their filters (usually the same as the Group ID) in 
*scanBasePackages* in your main 
+SpringBootApplication class to allow Spring to find the plugin *@Component*.
diff --git a/docs/en/latest/development.md b/docs/en/latest/development.md
index 01dcb24..567701d 100644
--- a/docs/en/latest/development.md
+++ b/docs/en/latest/development.md
@@ -23,38 +23,7 @@ title: Development
 
 ## Overview
 
-This document explains how to get started to develop the 
apisix-java-plugin-runner.
-
-Prerequisites
--
-
-* JDK 11
-* APISIX 2.12.0
-* Clone the 
[apisix-java-plugin-runner](https://github.com/apache/apisix-java-plugin-runner)
 project.
-* Refer to [Debug](how-it-works.md#debug)  to build the debug environment.
-
-Install

-
-```shell
-cd /path/to/apisix-java-plugin-runner
-./mvnw install
-```
-
-Write Filter
-
-
-Refer to the code in the 
[sample](https://github.com/apache/apisix-java-plugin-runner/tree/main/sample)
-to learn how to extend `PluginFilter`, define the order, rewrite requests and 
stop requests.
-
-  Code Location
-
-You need to put the code in 
[runner-plugin](https://github.com/apache/apisix-java-plugin-runner/tree/main/runner-plugin/src/main/java/org/apache/apisix/plugin/runner/filter)
-so that the `apisix-java-plugin-runner.jar` will contain the filter 
implementation class you wrote when you package it.
-
-  The order of filter execution
-
-The order of execution of the filter in the runner is determined by the index 
of the `conf` array in the `ext-plugin-pre-req` or `ext-plu

[apisix-java-plugin-runner] branch main updated: fix: hot reloading not working when java plugin runner is started from different working directory (#180)

2022-08-09 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 58f8088  fix: hot reloading not working when java plugin runner is 
started from different working directory (#180)
58f8088 is described below

commit 58f8088fc45f45c9f54676fe5f6fcbec8c6921a8
Author: Eric Liu <54130092+ericluo...@users.noreply.github.com>
AuthorDate: Tue Aug 9 00:41:16 2022 -0700

fix: hot reloading not working when java plugin runner is started from 
different working directory (#180)
---
 .../main/java/org/apache/apisix/plugin/runner/HotReloadProcess.java| 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/runner-starter/src/main/java/org/apache/apisix/plugin/runner/HotReloadProcess.java
 
b/runner-starter/src/main/java/org/apache/apisix/plugin/runner/HotReloadProcess.java
index 52ecaea..11e28c2 100644
--- 
a/runner-starter/src/main/java/org/apache/apisix/plugin/runner/HotReloadProcess.java
+++ 
b/runner-starter/src/main/java/org/apache/apisix/plugin/runner/HotReloadProcess.java
@@ -108,12 +108,13 @@ public class HotReloadProcess implements 
ApplicationContextAware {
 
 final BeanDefinitionRegistry registry = (BeanDefinitionRegistry) 
ctx.getAutowireCapableBeanFactory();
 String userDir = System.getProperty("user.dir");
+userDir = userDir.substring(0, 
userDir.lastIndexOf("apisix-java-plugin-runner") + 25);
 String workDir = userDir + loadPath;
 
 Path path = Paths.get(workDir);
 boolean exists = Files.exists(path);
 if (!exists) {
-logger.warn("The filter workdir fot hot reload {} not exists", 
workDir);
+logger.warn("The filter workdir for hot reload {} not exists", 
workDir);
 cancelHotReload("hotReloadFilter");
 return;
 }



[apisix-java-plugin-runner] branch main updated (e064f64 -> 1aa3126)

2022-08-09 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


from e064f64  docs: write documentation for shipping plugin (#179)
 add 1aa3126  fix: remove unnecessary classloader instantiation in main 
method (#181)

No new revisions were added by this update.

Summary of changes:
 .../org/apache/apisix/plugin/runner/PluginRunnerApplication.java| 6 --
 1 file changed, 6 deletions(-)



[apisix-java-plugin-runner] branch main updated: docs: write documentation for shipping plugin (#179)

2022-08-08 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new e064f64  docs: write documentation for shipping plugin (#179)
e064f64 is described below

commit e064f64a1d0b838dbd7942c579905bc127e32328
Author: Eric Liu <54130092+ericluo...@users.noreply.github.com>
AuthorDate: Mon Aug 8 06:41:39 2022 -0700

docs: write documentation for shipping plugin (#179)
---
 docs/en/latest/writing-filters.md | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/docs/en/latest/writing-filters.md 
b/docs/en/latest/writing-filters.md
index c77a105..78868fe 100644
--- a/docs/en/latest/writing-filters.md
+++ b/docs/en/latest/writing-filters.md
@@ -19,12 +19,14 @@
 
 # Overview
 
-This document explains how to develop Java plugins using 
apisix-java-plugin-runner's official Maven release.
+This document explains how to develop and ship Java plugins using 
apisix-java-plugin-runner's official Maven release.
 
 A Demo Project can be found at: 
https://github.com/tzssangglass/java-plugin-runner-demo-1
 
 ___
 
+### Write Java plugin
+
 Create a new Maven Spring Boot Project.
 
 Add the GAV of `apisix-java-plugin-runner` in `pom.xml`.
@@ -152,6 +154,23 @@ socket.file = /tmp/runner.sock
 ```
 This allows our java-plugin-runner to communicate with the main APISIX process.
 
-Finally, build your Java plugin! Be sure to label each filter class as a 
Spring *@Component* while following the guide at:
+Build your Java plugin! Be sure to label each filter class as a Spring 
*@Component* while following the guide at:
 
https://github.com/apache/apisix-java-plugin-runner/blob/main/docs/en/latest/development.md
 
+### Ship plugin
+
+In your plugin's *pom.xml*, add
+```
+
+exec
+
+```
+
+The standard Spring Boot executable JAR places all of your application classes 
inside *BOOT-INF/classes*, making it impossible to inject into another project. 
This config builds an additional non-executable JAR that can be used for 
dependency injection.
+
+Deploy the JARs to Maven Central.
+
+### Using a deployed plugin
+
+To use someone else's plugin, add their plugin's non-executable JAR as a 
dependency in your project. Add the package name of their filters (usually the 
same as the Group ID) in *scanBasePackages* in your main SpringBootApplication 
class to allow Spring to find the plugin *@Component*.
+



[apisix-java-plugin-runner] branch main updated: docs: add documentation for writing plugins using Maven JAR (#169)

2022-08-06 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new de48ff1  docs: add documentation for writing plugins using Maven JAR 
(#169)
de48ff1 is described below

commit de48ff1a5016618a3b3b78dded9cf96cabb170bb
Author: Eric Liu <54130092+ericluo...@users.noreply.github.com>
AuthorDate: Sat Aug 6 00:17:20 2022 -0700

docs: add documentation for writing plugins using Maven JAR (#169)
---
 docs/en/latest/writing-filters.md | 157 ++
 1 file changed, 157 insertions(+)

diff --git a/docs/en/latest/writing-filters.md 
b/docs/en/latest/writing-filters.md
new file mode 100644
index 000..c77a105
--- /dev/null
+++ b/docs/en/latest/writing-filters.md
@@ -0,0 +1,157 @@
+
+
+# Overview
+
+This document explains how to develop Java plugins using 
apisix-java-plugin-runner's official Maven release.
+
+A Demo Project can be found at: 
https://github.com/tzssangglass/java-plugin-runner-demo-1
+
+___
+
+Create a new Maven Spring Boot Project.
+
+Add the GAV of `apisix-java-plugin-runner` in `pom.xml`.
+```
+
+org.apache.apisix 
+apisix-runner-starter
+0.3.0
+
+```
+Be sure to add the Maven JAR into the class path. Use 
`org.apache.apisix:apisix-runner-starter:0.3.0` when asked for Maven 
coordinates. For Intellij IDEA users unsure on how to add files to the class 
path, follow 
https://stackoverflow.com/questions/16742085/adding-jar-files-to-intellijidea-classpath.
+
+To prevent multiple slf4j (a facade for various logging frameworks) bindings, 
exclude the *logback-classic* and *log4j-to-slf4j* transitive dependencies from 
being built within *spring-boot-starter*
+
+```
+
+org.springframework.boot
+spring-boot-starter
+
+   
+ch.qos.logback
+logback-classic
+   
+   
+org.apache.logging.log4j
+log4j-to-slf4j
+   
+
+
+```
+The final pom.xml file should look similar to
+```
+
+http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+4.0.0
+
+org.springframework.boot
+spring-boot-starter-parent
+2.7.1
+ 
+
+com.example
+demo
+0.0.1-SNAPSHOT
+demo
+demo
+
+11
+
+
+
+org.springframework.boot
+spring-boot-starter
+
+
+ch.qos.logback
+logback-classic
+
+
+org.apache.logging.log4j
+log4j-to-slf4j
+
+
+
+
+org.projectlombok
+lombok
+true
+
+
+org.springframework.boot
+spring-boot-starter-test
+test
+
+org.apache.apisix 
+apisix-runner-starter
+0.3.0
+
+
+
+
+
+org.springframework.boot
+spring-boot-maven-plugin
+
+
+
+org.projectlombok
+lombok
+
+
+
+
+
+
+
+```
+
+In the Java main class, include the line
+```
+@SpringBootApplication(scanBasePackages = 
{"your-filter's-package-name","org.apache.apisix.plugin.runner"})
+```
+*scanBasePackages* allows Spring Boot to read the *@Component* classes that 
exist inside of the Maven JAR along with the implemented Java filter.
+
+An example main class looks like
+```
+package com.example.demo;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages = 
{"com.example.demo","org.apache.apisix.plugin.runner"})
+public class DemoApplication {
+public static void main(String[] args) {
+SpringApplication.run(DemoApplication.class, args);
+}
+
+}
+```
+
+In *~/src/main/resources/application.properties*, add
+```
+socket.file = /tmp/runner.sock
+```
+This allows our java-plugin-runner to communicate with the main APISIX process.
+
+Finally, build your Java plugin! Be sure to label each filter class as a 
Spring *@Component* while following the guide at:
+https://github.com/apache/apisix-java-plugin-runner/blob/main/docs/en/latest/development.md
+



[apisix-java-plugin-runner] branch main updated: feat: support release jar to apache nexus (#176)

2022-08-03 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 7b4fbb5  feat: support release jar to apache nexus (#176)
7b4fbb5 is described below

commit 7b4fbb50a4da0e3f6c940529651de3c3f38c73d6
Author: tzssangglass 
AuthorDate: Thu Aug 4 11:46:56 2022 +0800

feat: support release jar to apache nexus (#176)
---
 .github/workflows/runner-e2e.yml   |  7 +--
 MAINTAIN.md| 56 --
 Makefile   | 11 -
 pom.xml| 13 +
 runner-core/pom.xml|  6 +--
 runner-dist/apisix-runner-bin-dist/pom.xml |  2 +-
 runner-dist/apisix-runner-src-dist/pom.xml |  4 +-
 runner-dist/pom.xml|  4 +-
 runner-plugin-sdk/pom.xml  |  2 +-
 runner-plugin/pom.xml  |  4 +-
 runner-starter/pom.xml |  9 +---
 .../apisix/plugin/runner/HotReloadProcess.java | 53 ++--
 .../plugin/runner/PluginRunnerApplication.java |  9 +++-
 runner-starter/src/main/resources/application.yaml |  1 +
 sample/pom.xml |  4 +-
 15 files changed, 93 insertions(+), 92 deletions(-)

diff --git a/.github/workflows/runner-e2e.yml b/.github/workflows/runner-e2e.yml
index 4e46548..47bcfee 100644
--- a/.github/workflows/runner-e2e.yml
+++ b/.github/workflows/runner-e2e.yml
@@ -27,10 +27,6 @@ on:
 branches:
   - main
 
-env:
-  JAVA_RUNNER_VERSION: 0.2.0
-
-
 jobs:
   run-test:
 runs-on: ubuntu-latest
@@ -51,13 +47,14 @@ jobs:
 
 - name: build runner
   run: |
+sed -i 's/apisix-runner-plugin-sdk/apisix-runner-plugin/' 
runner-core/pom.xml
 cp ./sample/src/main/java/org/apache/apisix/plugin/runner/filter/* 
./runner-plugin/src/main/java/org/apache/apisix/plugin/runner/filter/
 ./mvnw clean install -Dgpg.skip=true
 
 - name: startup runner
   run: |
 cd dist
-tar -zxvf 
apache-apisix-java-plugin-runner-$JAVA_RUNNER_VERSION-bin.tar.gz
+tar -zxvf apache-apisix-java-plugin-runner-*bin.tar.gz
 java -jar -DAPISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock 
-DAPISIX_CONF_EXPIRE_TIME=3600 
./apisix-runner-bin/apisix-java-plugin-runner.jar &
 
 - name: startup apisix
diff --git a/MAINTAIN.md b/MAINTAIN.md
index 0f57bea..5cf7f66 100644
--- a/MAINTAIN.md
+++ b/MAINTAIN.md
@@ -20,55 +20,15 @@
 Project Maintenance
 =
 
-Publishing to Maven Central Repository:
+## Release steps
 
-1. Create a Jira account by signing up at: 
https://issues.sonatype.org/secure/Signup!default.jspa
-2. Create a new project ticket at: 
https://issues.sonatype.org/secure/CreateIssue.jspa?issuetype=21&pid=10134 
(make sure the Issue Type is *New Project*)
-3. Generate a PGP Signature and distribute it to one or more public key 
servers. To generate a PGP Signature:
-   ```
-   $ gpg2 --gen-key
+### Publish Maven Artifacts
+Apache projects release all software packages through the ASF distribution 
system. 
 
-   $ gpg: key YOUR_KEY_ID marked as ultimately trusted
-   ```
-   To distribute:
-   ```
-   $ gpg2 --keyserver SERVER_NAME --send-keys YOUR_KEY_ID
-   ```
+1. Set up your development environment. For more details, see the [Publishing 
Maven Releases to Maven Central 
Repository](https://infra.apache.org/publishing-maven-artifacts.html).
 
-4. Find your ~.m2 folder (this folder is hidden on some systems)
-5. Update or create your settings.xml to contain your Jira and public key 
information:
-```xml
-
-  
-
-  ossrh
-  jira_username
-  jira_password
-
-  
-  
-
-  ossrh
-  
-true
-  
-  
-gpg2
-your_key_passphrase
-  
-
-  
-
-```
-6. Run Maven from the project directory
-```
-$ mvn clean deploy
-```
-7. Login to nexus repository manager using your Jira account created in step 1 
(https://s01.oss.sonatype.org/#welcome)
-8. Click on *Staging Repositories* on the left sidebar, your staging 
repository should be available
-9. Click on your staging repository and ensure it contains the correct 
contents, click *Close*, include a relevant description
-10. Wait a few seconds for Sonatype to buffer
-11. Click *Release*, include a relevant description
-12. Comment your Jira ticket to sync Maven Central with your Group ID
+2. Deploy the snapshot artifacts to Apache Nexus
 
-Congratulations! You have released to Maven Central Repository. The search 
query should sync within a few hours to a day.
\ No newline at end of file
+```shell
+make deploy
+```
diff --git a/Makefile b/Makefile
index d95db7a..6388a61 100644
--- a/Makefile
+++ b/Makef

[apisix-java-plugin-runner] branch main updated: feat: support hot reload of plugin filters (#158)

2022-07-19 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 4194525  feat: support hot reload of plugin filters (#158)
4194525 is described below

commit 4194525ae68e7015d39f20914846e59f5f38187f
Author: Eric Liu <54130092+ericluo...@users.noreply.github.com>
AuthorDate: Tue Jul 19 03:20:13 2022 -0700

feat: support hot reload of plugin filters (#158)
---
 .../apisix/plugin/runner/DynamicClassLoader.java   |  87 +
 .../apisix/plugin/runner/HotReloadProcess.java | 145 +
 .../plugin/runner/PluginRunnerApplication.java |  14 +-
 runner-starter/src/main/resources/application.yaml |   9 +-
 4 files changed, 252 insertions(+), 3 deletions(-)

diff --git 
a/runner-starter/src/main/java/org/apache/apisix/plugin/runner/DynamicClassLoader.java
 
b/runner-starter/src/main/java/org/apache/apisix/plugin/runner/DynamicClassLoader.java
new file mode 100644
index 000..308035c
--- /dev/null
+++ 
b/runner-starter/src/main/java/org/apache/apisix/plugin/runner/DynamicClassLoader.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.apisix.plugin.runner;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+
+public class DynamicClassLoader extends ClassLoader {
+private final Logger logger = 
LoggerFactory.getLogger(DynamicClassLoader.class);
+
+private String name;
+private String classDir;
+private String packageName;
+
+public DynamicClassLoader(ClassLoader parent) {
+super(parent);
+}
+
+@Override
+public Class findClass(String name) throws ClassNotFoundException {
+if (this.name == null) {
+return super.findClass(name);
+}
+
+// can we do replacements for windows only?
+String packagePath = packageName.replaceAll("\\.", "/");
+String classPath = "file:" + classDir + "/" + packagePath + "/" + 
this.name + ".class";
+
+URL url;
+URLConnection connection;
+try {
+url = new URL(classPath);
+connection = url.openConnection();
+} catch (IOException e) {
+logger.error("failed to open class file: {}", classPath, e);
+throw new RuntimeException(e);
+}
+try (InputStream input = connection.getInputStream();
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream()) {
+int data = input.read();
+while (data != -1) {
+buffer.write(data);
+data = input.read();
+}
+input.close();
+byte[] classData = buffer.toByteArray();
+String fullyQualifiedName = packageName + "." + name;
+return defineClass(fullyQualifiedName, classData, 0, 
classData.length);
+} catch (IOException e) {
+logger.error("failed to read class file: {}", classPath, e);
+throw new RuntimeException(e);
+}
+}
+
+public void setClassDir(String classDir) {
+this.classDir = classDir;
+}
+
+public void setName(String name) {
+this.name = name;
+}
+
+public void setPackageName(String name) {
+packageName = name;
+}
+}
diff --git 
a/runner-starter/src/main/java/org/apache/apisix/plugin/runner/HotReloadProcess.java
 
b/runner-starter/src/main/java/org/apache/apisix/plugin/runner/HotReloadProcess.java
new file mode 100644
index 000..0e60349
--- /dev/null
+++ 
b/runner-starter/src/main/java/org/apache/apisix/plugin/runner/HotReloadProcess.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regardin

[apisix-java-plugin-runner] branch main updated: docs: add hot-reloading documentation (#166)

2022-07-17 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new f1454d2  docs: add hot-reloading documentation (#166)
f1454d2 is described below

commit f1454d2eea8fd707780f24031c0d089bb2b97c39
Author: Eric Liu <54130092+ericluo...@users.noreply.github.com>
AuthorDate: Sun Jul 17 18:36:10 2022 -0700

docs: add hot-reloading documentation (#166)
---
 docs/en/latest/hot-reloading.md | 71 +
 1 file changed, 71 insertions(+)

diff --git a/docs/en/latest/hot-reloading.md b/docs/en/latest/hot-reloading.md
new file mode 100644
index 000..58195c6
--- /dev/null
+++ b/docs/en/latest/hot-reloading.md
@@ -0,0 +1,71 @@
+
+
+Hot Reloading
+=
+
+Overview
+-
+This document explains the new hot reload feature provided by 
apisix-java-plugin-runner.
+
+APISIX offers many fully-featured plugins and also allows users to develop 
their own plugins in Lua, Java, and other languages. Currently, APISIX offers 
hot reloading of plugins developed internally (Lua), however, hot reloading of 
external Java plugins is currently not supported.
+
+This feature provides hot reloading of Java plugins through the implementation 
of a custom classloader that can reload both Java classes and SpringBoot beans 
during runtime. When apisix-java-plugin-runner is launched, a scheduled side 
process watches for file modifications (create, delete, or change) in the 
folder that holds the user-implemented filters. When a user changes their 
filter while the plugin runner is running, the file watcher immediately picks 
up on it, and the file is recom [...]
+
+This saves time during development and enables users to change parts of their 
code without restarting the entire plugin-runner.
+
+How to use
+-
+Using and understanding the hot reload feature is simple.
+
+To begin, make sure your filters are located in the *runner/filter* module 
(along with *package-info.java*). If you are implementing filters from a 
different location, be sure to specify the load-path and the package name in 
the *application.yaml* file located in *runner-starter/src/main/resources/*.
+
+Path names should be enclosed in forward slashes 
*~/runner-plugin/src/main/java/org/apache/apisix/plugin/runner/filter/*
+
+Package name should look like *org.apache.apisix.plugin.runner.filter*
+
+Run APISIX and apisix-java-plugin-runner.
+
+Create a route for your filter (follow 
https://apisix.apache.org/blog/2021/06/21/use-java-to-write-apache-apisix-plugins/
 for more information).
+
+Send a request to your route to ensure everything is functioning.
+
+Modify your files in *runner/filter* (or other location).
+
+Send another request to your route, changes should be noticeable immediately.
+
+Keep in mind, for the file watcher to detect a change, it may be necessary to 
save the file.  
+
+How it works
+-
+Hot reload in apisix-java-plugin-runner is implemented using a custom 
classloader that dynamically recompiles and reloads filters. The Java 
WatchService is used to track file updates. Each file update is registered 
either as a
+1. File Modification
+2. File Creation
+3. File Deletion
+
+where each type of file update is handled slightly differently.
+
+After File Modification, the following process occurs:
+1. The Spring Bean (associated with the modified filter) is removed from the 
Spring Boot Application Context
+2. The Filter source code is recompiled
+3. The Filter class is reloaded
+4. The new Spring Bean is generated from the modified Filter class
+5. The new Spring Bean is loaded into Application Context
+
+File Creation and Deletion follow a similar process.



[apisix-java-plugin-runner] branch main updated: feat: support filter upstream responses (#164)

2022-07-14 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 4f144eb  feat: support filter upstream responses (#164)
4f144eb is described below

commit 4f144eb5e853b558652a8cef4ae7ed96ac037f5e
Author: tzssangglass 
AuthorDate: Fri Jul 15 14:13:52 2022 +0800

feat: support filter upstream responses (#164)
---
 docs/en/latest/development.md  |  19 +++
 .../apisix/plugin/runner/constants/Constants.java  |   2 +
 .../plugin/runner/handler/PayloadDecoder.java  |  22 ++-
 ...HTTPReqCallHandler.java => RpcCallHandler.java} |  78 +--
 .../plugin/runner/server/ApplicationRunner.java|   6 +-
 .../runner/handler/A6HttpCallHandlerTest.java  |   6 +-
 .../plugin/runner/handler/ExtraInfoTest.java   |   6 +-
 .../plugin/runner/handler/PostFilterTest.java  | 149 +
 runner-plugin-sdk/pom.xml  |   2 +-
 .../apache/apisix/plugin/runner/HttpResponse.java  |   6 +-
 .../apache/apisix/plugin/runner/PostRequest.java   |  90 +
 .../apache/apisix/plugin/runner/PostResponse.java  | 125 +
 .../apisix/plugin/runner/filter/PluginFilter.java  |  29 +++-
 .../plugin/runner/filter/PluginFilterChain.java|  11 ++
 .../plugin/runner/filter/ResponseFilter.java   |  51 +++
 src/main/checkstyle/checkstyle-suppressions.xml|   3 +
 tests/e2e/plugins/plugins_post_test.go |  71 ++
 17 files changed, 643 insertions(+), 33 deletions(-)

diff --git a/docs/en/latest/development.md b/docs/en/latest/development.md
index 339f58f..01dcb24 100644
--- a/docs/en/latest/development.md
+++ b/docs/en/latest/development.md
@@ -160,6 +160,7 @@ and the name of each filter's implementation class is the 
return value of its ov
 
 If you perform the following function call in the filter chain of the 
implementation class
 
+* request.getConfig()
 *  request.setPath()
 *  request.setHeader()
 *  request.setArg()
@@ -178,6 +179,24 @@ If you perform the following function call in the filter 
chain of the implementa
 this means to stop the current request, the client will receive
 the relevant parameters generated here.
 
+  Get the upstream response and process
+
+You can override the `postFilter` function, in your override function,
+you can get the origin upstream response by `PostRequest`,
+and you can also set the `PostResponse` to override the origin upstream 
response and return it to the client.
+
+# PostRequest
+
+* request.getConfig()
+* request.getUpstreamHeaders()
+* request.getUpstreamStatusCode()
+
+# PostResponse
+
+*  response.setStatusCode()
+*  response.setHeader()
+*  response.setBody()
+
 Test
 
 
diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/constants/Constants.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/constants/Constants.java
index 58104cf..5327de4 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/constants/Constants.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/constants/Constants.java
@@ -26,4 +26,6 @@ public class Constants {
 public static final byte RPC_HTTP_REQ_CALL = 2;
 
 public static final byte RPC_EXTRA_INFO = 3;
+
+public static final byte RPC_HTTP_RESP_CALL = 4;
 }
diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/PayloadDecoder.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/PayloadDecoder.java
index eb49028..a42ad78 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/PayloadDecoder.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/PayloadDecoder.java
@@ -21,17 +21,18 @@ import io.github.api7.A6.Err.Code;
 import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.SimpleChannelInboundHandler;
+import org.apache.apisix.plugin.runner.A6ConfigRequest;
+import org.apache.apisix.plugin.runner.A6ErrRequest;
+import org.apache.apisix.plugin.runner.A6Request;
+import org.apache.apisix.plugin.runner.ExtraInfoResponse;
+import org.apache.apisix.plugin.runner.HttpRequest;
+import org.apache.apisix.plugin.runner.PostRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.nio.BufferUnderflowException;
 import java.nio.ByteBuffer;
 
-import org.apache.apisix.plugin.runner.A6ConfigRequest;
-import org.apache.apisix.plugin.runner.A6ErrRequest;
-import org.apache.apisix.plugin.runner.A6Request;
-import org.apache.apisix.plugin.runner.HttpRequest;
-import org.apache.apisix.plugin.runner.ExtraInfoResponse;
 import org.apache.apisix.plugin.runner.constants.Constants;
 
 public class PayloadDecoder extends SimpleChannelInboundHandler {
@@ -84,6 +85,17 @@ public class Payloa

[apisix-java-plugin-runner] branch main updated: ci: update Check License Header (#163)

2022-07-08 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 939b0c1  ci: update Check License Header (#163)
939b0c1 is described below

commit 939b0c149c795e3d8ba6ffa72f2fd0c4c7940740
Author: kezhenxu94 
AuthorDate: Sat Jul 9 02:39:43 2022 +0800

ci: update Check License Header (#163)
---
 .github/workflows/ci.yaml | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index bb37551..c2132b1 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -37,9 +37,7 @@ jobs:
   distribution: 'zulu'
   java-version: '11'
   - name: Check License Header
-uses: apache/skywalking-eyes@main
-env:
-   GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+uses: 
apache/skywalking-eyes/header@501a28d2fb4a9b962661987e50cf0219631b32ff
   - name: 'Install & Test'
 run: mvn clean install -Dgpg.skip=true
 



[apisix-java-plugin-runner] branch main updated: docs: add MAINTAIN.md (#160)

2022-07-05 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 713a2c5  docs: add MAINTAIN.md (#160)
713a2c5 is described below

commit 713a2c5b9424c25f62742186c2baaccdfb700c79
Author: Eric Liu <54130092+ericluo...@users.noreply.github.com>
AuthorDate: Tue Jul 5 10:59:24 2022 -0400

docs: add MAINTAIN.md (#160)
---
 MAINTAIN.md | 74 +
 1 file changed, 74 insertions(+)

diff --git a/MAINTAIN.md b/MAINTAIN.md
new file mode 100644
index 000..0f57bea
--- /dev/null
+++ b/MAINTAIN.md
@@ -0,0 +1,74 @@
+
+
+Project Maintenance
+=
+
+Publishing to Maven Central Repository:
+
+1. Create a Jira account by signing up at: 
https://issues.sonatype.org/secure/Signup!default.jspa
+2. Create a new project ticket at: 
https://issues.sonatype.org/secure/CreateIssue.jspa?issuetype=21&pid=10134 
(make sure the Issue Type is *New Project*)
+3. Generate a PGP Signature and distribute it to one or more public key 
servers. To generate a PGP Signature:
+   ```
+   $ gpg2 --gen-key
+
+   $ gpg: key YOUR_KEY_ID marked as ultimately trusted
+   ```
+   To distribute:
+   ```
+   $ gpg2 --keyserver SERVER_NAME --send-keys YOUR_KEY_ID
+   ```
+
+4. Find your ~.m2 folder (this folder is hidden on some systems)
+5. Update or create your settings.xml to contain your Jira and public key 
information:
+```xml
+
+  
+
+  ossrh
+  jira_username
+  jira_password
+
+  
+  
+
+  ossrh
+  
+true
+  
+  
+gpg2
+your_key_passphrase
+  
+
+  
+
+```
+6. Run Maven from the project directory
+```
+$ mvn clean deploy
+```
+7. Login to nexus repository manager using your Jira account created in step 1 
(https://s01.oss.sonatype.org/#welcome)
+8. Click on *Staging Repositories* on the left sidebar, your staging 
repository should be available
+9. Click on your staging repository and ensure it contains the correct 
contents, click *Close*, include a relevant description
+10. Wait a few seconds for Sonatype to buffer
+11. Click *Release*, include a relevant description
+12. Comment your Jira ticket to sync Maven Central with your Group ID
+
+Congratulations! You have released to Maven Central Repository. The search 
query should sync within a few hours to a day.
\ No newline at end of file



[apisix-java-plugin-runner] branch main updated: chore: upgrade spring boot release version (#157)

2022-06-30 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 8224fdf  chore: upgrade spring boot release version (#157)
8224fdf is described below

commit 8224fdf9caa8c8ea2803016a5406a554e5b81709
Author: tzssangglass 
AuthorDate: Thu Jun 30 17:12:10 2022 +0800

chore: upgrade spring boot release version (#157)
---
 .github/workflows/ci.yaml| 4 ++--
 .github/workflows/runner-e2e.yml | 2 +-
 pom.xml  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index f7582a7..bb37551 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -41,7 +41,7 @@ jobs:
 env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   - name: 'Install & Test'
-run: mvn clean install
+run: mvn clean install -Dgpg.skip=true
 
   CI-on-MacOS:
 runs-on: macos-latest
@@ -55,4 +55,4 @@ jobs:
   distribution: 'zulu'
   java-version: '11'
   - name: 'Install & Test'
-run: ./mvnw clean install
+run: ./mvnw clean install -Dgpg.skip=true
diff --git a/.github/workflows/runner-e2e.yml b/.github/workflows/runner-e2e.yml
index 30baa22..4e46548 100644
--- a/.github/workflows/runner-e2e.yml
+++ b/.github/workflows/runner-e2e.yml
@@ -52,7 +52,7 @@ jobs:
 - name: build runner
   run: |
 cp ./sample/src/main/java/org/apache/apisix/plugin/runner/filter/* 
./runner-plugin/src/main/java/org/apache/apisix/plugin/runner/filter/
-./mvnw install
+./mvnw clean install -Dgpg.skip=true
 
 - name: startup runner
   run: |
diff --git a/pom.xml b/pom.xml
index c9b23c8..346298d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -70,7 +70,7 @@
 11
 4.1.54.Final
 30.1.1-jre
-2.4.5
+2.6.8
 3.8.0
 
 



[apisix] branch next updated (10deb7888 -> 5ca173747)

2022-06-29 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch next
in repository https://gitbox.apache.org/repos/asf/apisix.git


 discard 10deb7888 docs: add building apisix Chinese doc. (#7318)
 discard 6e0847764 docs: fix typo and syntax (#7347)
 discard 435889d8f chore(deployment): disable former health check to avoid 
flaky test (#7344)
 discard 54f5ab2b1 docs: fix typo (#7337)
 discard 7d99fdf4b chore: update the license location threshold. (#7329)
 discard 75358b131 docs: update "Loggers" Plugins 5/5 (#7308)
 discard 456d9fd88 feat(deployment): send the right Host & SNI (#7323)
 discard fcc2a2c06 chore: adjust etcd max_fails for the admin api and add 
comments (#7311)
 discard 0f6d8ac1a feat: config center will check plugin_metadata (#7315)
 discard 4c5380a1f feat(sls-logger): support custom log format (#7328)
 discard 52b9aafb6 docs: update control plane service discovery doc. (#7289)
 discard f9f2b8a4c feat(deployment): select backend & retry (#7309)
 discard 3a15bd115 docs: update "Loggers" Plugins 2/n (#7246)
 discard 9f01b2b24 docs: update "Loggers" Plugins (#7247)
 discard 4c49771b2 feat: allows users to specify plugin execution priority 
(#7273)
 discard 2badeb2c3 feat: ready to release 2.13.2 (#7293)
 discard 17d6f23e7 docs(ext-plugin-post-resp): add ext-plugin-post-resp plugin 
documentation (#7306)
 discard aed5898fe change(etcd): the health_check_retry should be named as 
startup_retry (#7304)
 discard 91b8fb675 docs: 2.14.1 isn't a LTS version (#7305)
 discard f5c02901d feat(deployment): data_plane does not write data to etcd 
(#7294)
 discard cdee8d766 fix: adjust the execution priority of request-id to fix 
opentelemetry has no request id (#7281)
 discard 0290b30a3 perf: don't cache all request headers on critical code path 
(#7287)
 discard 8c29339f9 docs: update "Loggers" Plugin 4/n (#7254)
 discard 54406b2a1 chore: explain why new injected fields should be under 
`_meta` (#7290)
 discard 521a68ded docs: create page for "Building APISIX" (#7219)
 discard 54de1ee92 docs(response-rewrite): change image source from jsdelivr to 
github (#7193)
 discard 6342deec3 docs: udpate prometheus Chinese doc (#7275)
 discard 66d974ff7 fix: the argument to usleep should be integer (#7271)
 discard 1fcf517cf feat(deployment): support connecting to etcd via https 
(#7269)
 discard 5ef7a5796 fix(traffic-split): the default timeout doesn't match the 
one in Nginx (#7277)
 discard d25fbd324 feat: export some importent params for kafka-client (#7266)
 discard 194be9b01 feat(cli): display test option when help (#7268)
 discard 10de675ba docs: update Metric plugin documents (#7188)
 discard 0e73664c3 fix: grpc-transcode request support object array  (#7231)
 discard 49094083c chore(ci): upgrade etcd version to 3.5.4 (#7265)
 discard 34f579bf7 docs: update Chinese opentelemetry docs (#7235)
 discard 3b05a330d docs: fix err in batch-processor (#7259)
 discard 6d0589400 docs(deployment): sync design to online docs (#7256)
 discard 6499c344f feat(deployment): add structure of traditional role (#7249)
 discard 11dcaabba fix(benchmark): write worker_processes into config.yaml 
(#7250)
 discard ab4ca6972 docs: correct the repo url (#7253)
 discard 72c4cec31 feat: Add support for capturing OIDC refresh tokens (#7220)
 discard 82e3ecb14 feat(ssl): support get upstream cert from ssl object (#7221)
 discard 4e171c23a chore: validate etcd conf strictly (#7245)
 discard ee54ad764 fix(api-response): check response header format (#7238)
 discard 51e8eb0c9 fix: duplicate X-Forwarded-Proto will be sent as string 
(#7229)
 discard 0a2a2eb68 fix: distinguish different upstreams even they have the same 
addr (#7213)
 discard 5c6b0051e docs: make company on README more preciser (#7230)
 discard cfee9c3f6 test: remove unused required etcd (#7225)
 discard 273f608cb fix: add debug yaml validation (#7201)
 discard 45457384d change: remove upstream.enable_websocket which is deprecated 
since 2020 (#7222)
 discard 07e636cc5 docs: add re case on response-rewrite plugin (#7197)
 discard 9ade30d6b docs: add API Gateway keyword and AWS graviton3. (#7217)
 discard 8465f6e12 fix(response-rewrite): schema format error (#7212)
 discard 9045cf5ea docs(proxy-rewrite): remove empty space (#7210)
 discard ea0f898e3 chore: require http_stub_status_module exists (#7208)
 discard 2bd3043cf docs: update skywalking Chinese doc (#7170)
 discard cf1c0c70a build(deps): bump actions/setup-node from 3.2.0 to 3.3.0 
(#7203)
 discard 6725fe093 docs: update redirect plugin's Required field (#7195)
 discard b16f0e1d5 docs: update slack and mailing list link's hash (#7194)
 discard 0d0a886e4 perf: reuse ctx in ssl phase (#7196)
 discard fe2591e64 docs: update "Loggers" Plugins (#7191)
 discard 59bd77438 docs(control-api): add some notes for healthcheck API (#7184)
 discard 7d59b74e8 docs(prometheus): need to enable prom

[apisix-java-plugin-runner] branch main updated: feat: support deploy jar to the Maven Central repository (#155)

2022-06-29 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new e0d3548  feat: support deploy jar to the Maven Central repository 
(#155)
e0d3548 is described below

commit e0d3548794625d7f03cd4f97d968e9127e2e8d33
Author: Eric Liu <54130092+ericluo...@users.noreply.github.com>
AuthorDate: Wed Jun 29 18:05:02 2022 -0700

feat: support deploy jar to the Maven Central repository (#155)
---
 pom.xml | 69 +
 1 file changed, 69 insertions(+)

diff --git a/pom.xml b/pom.xml
index 8aaecd2..c9b23c8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,6 +24,17 @@
 apisix-plugin-runner
 0.2.0
 
+
+
+ossrh
+
https://s01.oss.sonatype.org/content/repositories/snapshots
+
+
+ossrh
+
https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+  
 
 org.apache
 apache
@@ -74,6 +85,13 @@
 
 
 
+
+org.sonatype.oss
+oss-parent
+9
+pom
+import
+
 
 org.apache.logging.log4j
 log4j-bom
@@ -154,6 +172,57 @@
 
 
 
+
+org.apache.maven.plugins
+maven-release-plugin
+3.0.0-M6
+
+
+org.apache.maven.plugins
+maven-gpg-plugin
+1.5
+
+
+sign-artifacts
+verify
+
+sign
+
+
+
+
+
+org.apache.maven.plugins
+maven-javadoc-plugin
+
+false
+-Xdoclint:none
+8
+
+2.9.1
+
+
+attach-javadocs
+
+javadoc
+
+
+
+
+
+org.apache.maven.plugins
+maven-source-plugin
+2.2.1
+
+
+validate
+process-sources
+
+jar-no-fork
+
+
+
+
 
 
 



[apisix-docker] branch release/apisix-2.13.2 updated: chore: use host network to build images

2022-06-28 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch release/apisix-2.13.2
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git


The following commit(s) were added to refs/heads/release/apisix-2.13.2 by this 
push:
 new c9a48a1  chore: use host network to build images
c9a48a1 is described below

commit c9a48a12d5ddab255543ac66611e26ee18a7f29f
Author: tzssangglass 
AuthorDate: Wed Jun 29 10:43:07 2022 +0800

chore: use host network to build images
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index acf15ce..bb33f62 100644
--- a/Makefile
+++ b/Makefile
@@ -64,7 +64,7 @@ endef
 .PHONY: build-on-centos
 build-on-centos:
@$(call func_echo_status, "$@ -> [ Start ]")
-   $(ENV_DOCKER) build -t $(ENV_APISIX_IMAGE_TAG_NAME)-centos -f 
./centos/Dockerfile .
+   $(ENV_DOCKER) build --network=host -t 
$(ENV_APISIX_IMAGE_TAG_NAME)-centos -f ./centos/Dockerfile .
@$(call func_echo_success_status, "$@ -> [ Done ]")
 
 



[apisix-docker] branch release/apisix-2.13.2 created (now 3385cdf)

2022-06-28 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/apisix-2.13.2
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git


  at 3385cdf  feat: upgrade APISIX to 2.13.2

No new revisions were added by this update.



[apisix] tag 2.13.2 created (now 644a54a3f)

2022-06-21 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to tag 2.13.2
in repository https://gitbox.apache.org/repos/asf/apisix.git


  at 644a54a3f (commit)
No new revisions were added by this update.



[apisix] 01/01: resolve code review

2022-05-18 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch apt_up
in repository https://gitbox.apache.org/repos/asf/apisix.git

commit 24332bf773915d51f1c8b3e04ceb79a34903f6ad
Author: tzssangglass 
AuthorDate: Thu May 19 13:56:09 2022 +0800

resolve code review
---
 .github/workflows/build.yml | 2 +-
 .github/workflows/cli-master.yml| 2 +-
 .github/workflows/cli.yml   | 2 +-
 .github/workflows/kubernetes-ci.yml | 2 +-
 .github/workflows/tars-ci.yml   | 2 +-
 ci/common.sh| 7 ---
 ci/linux_openresty_common_runner.sh | 7 +++
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 3e0f6acd1..133116af8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -83,7 +83,7 @@ jobs:
   tar zxvf ${{ steps.branch_env.outputs.fullname }}
 
   - name: Linux Get dependencies
-run: sudo ./ci/common.sh linux_get_dependencies
+run: sudo ./ci/${{ matrix.os_name }}_runner.sh linux_get_dependencies
 
   - name: Build wasm code
 if: matrix.os_name == 'linux_openresty'
diff --git a/.github/workflows/cli-master.yml b/.github/workflows/cli-master.yml
index 0462c4de3..2a0a64b8a 100644
--- a/.github/workflows/cli-master.yml
+++ b/.github/workflows/cli-master.yml
@@ -50,7 +50,7 @@ jobs:
   project_compose_ci=ci/pod/docker-compose.common.yml make ci-env-up
 
   - name: Linux Get dependencies
-run: sudo ./ci/common.sh linux_get_dependencies
+run: sudo ./ci/linux_openresty_common_runner.sh linux_get_dependencies
 
   - name: Linux Install
 run: |
diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml
index e0a26613b..e351e62bc 100644
--- a/.github/workflows/cli.yml
+++ b/.github/workflows/cli.yml
@@ -55,7 +55,7 @@ jobs:
   project_compose_ci=ci/pod/docker-compose.common.yml make ci-env-up
 
   - name: Linux Get dependencies
-run: sudo ./ci/common.sh linux_get_dependencies
+run: sudo ./ci/linux_openresty_common_runner.sh linux_get_dependencies
 
   - name: Linux Before install
 run: sudo ./ci/${{ matrix.job_name }}_runner.sh before_install
diff --git a/.github/workflows/kubernetes-ci.yml 
b/.github/workflows/kubernetes-ci.yml
index 94c647a96..216fa6f8d 100644
--- a/.github/workflows/kubernetes-ci.yml
+++ b/.github/workflows/kubernetes-ci.yml
@@ -77,7 +77,7 @@ jobs:
 
   - name: Linux Install
 run: |
-  sudo ./ci/common.sh linux_get_dependencies
+  sudo ./ci/${{ matrix.os_name }}_runner.sh linux_get_dependencies
   sudo cpanm --notest Test::Nginx >build.log 2>&1 || (cat build.log && 
exit 1)
   sudo --preserve-env=OPENRESTY_VERSION ./ci/${{ matrix.os_name 
}}_runner.sh do_install
 
diff --git a/.github/workflows/tars-ci.yml b/.github/workflows/tars-ci.yml
index c76d8d0c6..985361643 100644
--- a/.github/workflows/tars-ci.yml
+++ b/.github/workflows/tars-ci.yml
@@ -48,7 +48,7 @@ jobs:
 
   - name: Linux Install
 run: |
-  sudo ./ci/common.sh linux_get_dependencies
+  sudo ./ci/${{ matrix.os_name }}_runner.sh linux_get_dependencies
   sudo cpanm --notest Test::Nginx >build.log 2>&1 || (cat build.log && 
exit 1)
   sudo --preserve-env=OPENRESTY_VERSION ./ci/${{ matrix.os_name 
}}_runner.sh do_install
 
diff --git a/ci/common.sh b/ci/common.sh
index 8b0f3b561..fd5575c0f 100644
--- a/ci/common.sh
+++ b/ci/common.sh
@@ -85,10 +85,3 @@ linux_get_dependencies () {
 apt update
 apt install -y cpanminus build-essential libncurses5-dev libreadline-dev 
libssl-dev perl libpcre3 libpcre3-dev libldap2-dev
 }
-
-case_opt=$1
-case $case_opt in
-(linux_get_dependencies)
-linux_get_dependencies
-;;
-esac
diff --git a/ci/linux_openresty_common_runner.sh 
b/ci/linux_openresty_common_runner.sh
index 0a1fd68e7..767a9b297 100755
--- a/ci/linux_openresty_common_runner.sh
+++ b/ci/linux_openresty_common_runner.sh
@@ -101,6 +101,10 @@ after_success() {
 echo "done"
 }
 
+linux_get_dependencies() {
+linux_get_dependencies
+}
+
 case_opt=$1
 shift
 
@@ -117,4 +121,7 @@ script)
 after_success)
 after_success "$@"
 ;;
+linux_get_dependencies)
+linux_get_dependencies "$@"
+;;
 esac



[apisix] branch apt_up created (now 24332bf77)

2022-05-18 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch apt_up
in repository https://gitbox.apache.org/repos/asf/apisix.git


  at 24332bf77 resolve code review

This branch includes the following new commits:

 new 24332bf77 resolve code review

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[apisix] branch master updated: ci(traffic-split): improve ci stability (#7055)

2022-05-15 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 7131ee7de ci(traffic-split): improve ci stability (#7055)
7131ee7de is described below

commit 7131ee7de906794e7267ff33d23c983a3d97dde9
Author: soulbird 
AuthorDate: Mon May 16 14:24:27 2022 +0800

ci(traffic-split): improve ci stability (#7055)

Co-authored-by: soulbird 
---
 t/plugin/traffic-split.t | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/t/plugin/traffic-split.t b/t/plugin/traffic-split.t
index ea11f85e3..7f1afd5dd 100644
--- a/t/plugin/traffic-split.t
+++ b/t/plugin/traffic-split.t
@@ -696,7 +696,7 @@ GET /t
 local json = require("toolkit.json")
 local t = require("lib.test_admin").test
 local data = {
-  uri = "/server_port",
+  uri = "/",
   plugins = {
 ["traffic-split"] = {
   rules = { {
@@ -704,8 +704,10 @@ GET /t
   upstream = {
 name = "upstream_A",
 type = "roundrobin",
+pass_host = "rewrite",
+upstream_host = "www.apiseven.com",
 nodes = {
-  ["apiseven.com:80"] = 0
+  ["www.apiseven.com:80"] = 0
 }
   },
   weight = 10
@@ -743,10 +745,10 @@ passed
 
 === TEST 19: domain name resolved successfully
 --- request
-GET /server_port
 error_code: 502
+GET /
+--- error_code: 200
 --- error_log eval
-qr/dns resolver domain: apiseven.com to \d+.\d+.\d+.\d+/
+qr/dns resolver domain: www.apiseven.com to \d+.\d+.\d+.\d+/
 
 
 



[apisix-website] branch master updated: feat: release APISIX 2.13.1 (#1036)

2022-04-15 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
 new bf9bdb2e4d7 feat: release APISIX 2.13.1 (#1036)
bf9bdb2e4d7 is described below

commit bf9bdb2e4d77aae0c3cd9e5690cb211792a03e69
Author: tzssangglass 
AuthorDate: Sat Apr 16 13:23:11 2022 +0800

feat: release APISIX 2.13.1 (#1036)
---
 website/config/docs.js  |  4 ++--
 website/config/downloads.js | 10 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/website/config/docs.js b/website/config/docs.js
index 4792c7ad2ef..eaaea9c298b 100644
--- a/website/config/docs.js
+++ b/website/config/docs.js
@@ -6,8 +6,8 @@ module.exports = [
 shape: 'triangle',
 color: '#e8433e',
 githubRepo: 'apache/apisix',
-version: '2.13.0',
-releaseDate: '2022-03-24',
+version: '2.13.1',
+releaseDate: '2022-04-15',
 firstDocPath: '/getting-started',
   },
   {
diff --git a/website/config/downloads.js b/website/config/downloads.js
index 29124119aaa..3fb5cab678e 100644
--- a/website/config/downloads.js
+++ b/website/config/downloads.js
@@ -7,12 +7,12 @@ module.exports = [
 color: '#e8433e',
 githubRepo: 'apache/apisix',
 githubBranch: 'master',
-downloadPath: 'apisix/2.13.0/apache-apisix-2.13.0-src',
+downloadPath: 'apisix/2.13.1/apache-apisix-2.13.1-src',
 dockerhubPath: 'apisix',
-version: '2.13.0',
-LTSDownloadPath: 'apisix/2.13.0/apache-apisix-2.13.0-src',
-LTSVersion: '2.13.0',
-releaseDate: '2022-03-24',
+version: '2.13.1',
+LTSDownloadPath: 'apisix/2.13.1/apache-apisix-2.13.1-src',
+LTSVersion: '2.13.1',
+releaseDate: '2022-04-15',
 firstDocPath: '/getting-started',
   },
   {



[apisix-helm-chart] branch master updated: feat: upgrade APISIX to 2.13.1 (#266)

2022-04-15 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
 new d220199  feat: upgrade APISIX to 2.13.1 (#266)
d220199 is described below

commit d220199e60ad10eb2998e6e57e45fe43df25a44a
Author: tzssangglass 
AuthorDate: Fri Apr 15 23:52:42 2022 +0800

feat: upgrade APISIX to 2.13.1 (#266)
---
 charts/apisix/Chart.yaml  | 4 ++--
 charts/apisix/values.yaml | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/charts/apisix/Chart.yaml b/charts/apisix/Chart.yaml
index 58a846b..4a42c6e 100644
--- a/charts/apisix/Chart.yaml
+++ b/charts/apisix/Chart.yaml
@@ -31,12 +31,12 @@ type: application
 # This is the chart version. This version number should be incremented each 
time you make changes
 # to the chart and its templates, including the app version.
 # Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 0.9.0
+version: 0.9.1
 
 # This is the version number of the application being deployed. This version 
number should be
 # incremented each time you make changes to the application. Versions are not 
expected to
 # follow Semantic Versioning. They should reflect the version the application 
is using.
-appVersion: 2.13.0
+appVersion: 2.13.1
 
 dependencies:
   - name: etcd
diff --git a/charts/apisix/values.yaml b/charts/apisix/values.yaml
index 1057ce4..3213dff 100644
--- a/charts/apisix/values.yaml
+++ b/charts/apisix/values.yaml
@@ -56,7 +56,7 @@ apisix:
 repository: apache/apisix
 pullPolicy: IfNotPresent
 # Overrides the image tag whose default is the chart appVersion.
-tag: 2.13.0-alpine
+tag: 2.13.1-alpine
 
   # Use a `DaemonSet` or `Deployment`
   kind: Deployment



[apisix-docker] branch release/apisix-2.13.1 created (now bb35017)

2022-04-15 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/apisix-2.13.1
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git


  at bb35017  feat: upgrade APISIX to 2.13.1 (#299)

No new revisions were added by this update.



[apisix-docker] branch release/apisix-2.13.1 created (now e398cb6)

2022-04-15 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/apisix-2.13.1
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git


  at e398cb6  feat: upgrade APISIX to 2.13.0 (#295)

No new revisions were added by this update.



[apisix-docker] branch release/apisix-2.13.1 created (now e398cb6)

2022-04-15 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/apisix-2.13.1
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git


  at e398cb6  feat: upgrade APISIX to 2.13.0 (#295)

No new revisions were added by this update.



[apisix] tag 2.13.1 created (now a22336785)

2022-04-15 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to tag 2.13.1
in repository https://gitbox.apache.org/repos/asf/apisix.git


  at a22336785 (commit)
No new revisions were added by this update.



[apisix-java-plugin-runner] branch main updated: refactor: rename the name of the function that gets all the headers to 'getHeaders'. (#132)

2022-03-15 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 35159bb  refactor: rename the name of the function that gets all the 
headers to 'getHeaders'. (#132)
35159bb is described below

commit 35159bb2661e54bf984625ac94b49d7fd06da46f
Author: 123liubao <87936714+123liu...@users.noreply.github.com>
AuthorDate: Wed Mar 16 11:25:16 2022 +0800

refactor: rename the name of the function that gets all the headers to 
'getHeaders'. (#132)
---
 .../org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java   | 2 +-
 .../apache/apisix/plugin/runner/handler/A6HttpCallHandlerTest.java| 4 ++--
 .../src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java| 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java
index 2152703..f28d3fa 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java
@@ -199,7 +199,7 @@ public class HTTPReqCallHandler extends 
SimpleChannelInboundHandler {
 }
 
 private void preReadReq() {
-currReq.getHeader();
+currReq.getHeaders();
 currReq.getPath();
 currReq.getMethod();
 currReq.getArgs();
diff --git 
a/runner-core/src/test/java/org/apache/apisix/plugin/runner/handler/A6HttpCallHandlerTest.java
 
b/runner-core/src/test/java/org/apache/apisix/plugin/runner/handler/A6HttpCallHandlerTest.java
index 114942c..7967059 100644
--- 
a/runner-core/src/test/java/org/apache/apisix/plugin/runner/handler/A6HttpCallHandlerTest.java
+++ 
b/runner-core/src/test/java/org/apache/apisix/plugin/runner/handler/A6HttpCallHandlerTest.java
@@ -99,8 +99,8 @@ class A6HttpCallHandlerTest {
 }
 }
 
-if (!Objects.isNull(request.getHeader())) {
-for (Map.Entry header : 
request.getHeader().entrySet()) {
+if (!Objects.isNull(request.getHeaders())) {
+for (Map.Entry header : 
request.getHeaders().entrySet()) {
 System.out.println("do filter: header key: " + 
header.getKey());
 System.out.println("do filter: header value: " + 
header.getValue());
 }
diff --git 
a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java
 
b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java
index d4f75b4..896a911 100644
--- 
a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java
+++ 
b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java
@@ -138,7 +138,7 @@ public class HttpRequest implements A6Request {
  *
  * @return the all headers
  */
-public Map getHeader() {
+public Map getHeaders() {
 if (Objects.isNull(headers)) {
 headers = new HashMap<>();
 for (int i = 0; i < req.headersLength(); i++) {
@@ -164,7 +164,7 @@ public class HttpRequest implements A6Request {
  * @return the header value or null
  */
 public String getHeader(String headerName) {
-Map headers = getHeader();
+Map headers = getHeaders();
 if (!CollectionUtils.isEmpty(headers)) {
 for (Map.Entry header : headers.entrySet()) {
 if (header.getKey().equals(headerName)) {


[apisix-java-plugin-runner] branch main updated: chore(e2e): update apisix image to dev (#134)

2022-03-15 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new d31c455  chore(e2e): update apisix image to dev (#134)
d31c455 is described below

commit d31c455987bc4debdaec08dcd7460191d699bd03
Author: 帅进超 
AuthorDate: Wed Mar 16 11:13:48 2022 +0800

chore(e2e): update apisix image to dev (#134)
---
 ci/docker-compose.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ci/docker-compose.yml b/ci/docker-compose.yml
index 7724085..b0c838a 100644
--- a/ci/docker-compose.yml
+++ b/ci/docker-compose.yml
@@ -19,7 +19,7 @@ version: "3"
 
 services:
   apisix:
-image: apache/apisix:2.12.0-alpine
+image: apache/apisix:dev
 restart: always
 volumes:
   - ./apisix/config.yaml:/usr/local/apisix/conf/config.yaml:ro


[apisix-java-plugin-runner] branch main updated: feat(ci): add e2e test framework (#133)

2022-03-10 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 8a8a8a3  feat(ci): add e2e test framework (#133)
8a8a8a3 is described below

commit 8a8a8a3a867a6ed9f48c7a9b931eb0c69a575e98
Author: 帅进超 
AuthorDate: Thu Mar 10 22:16:58 2022 +0800

feat(ci): add e2e test framework (#133)
---
 .github/workflows/runner-e2e.yml  |  73 +
 .licenserc.yaml   |   2 +
 ci/apisix/config.yaml |  38 +++
 ci/docker-compose.yml |  64 
 tests/e2e/go.mod  |   9 ++
 tests/e2e/go.sum  | 166 ++
 tests/e2e/plugins/plugins_rewrite_test.go |  67 
 tests/e2e/plugins/plugins_stop_test.go|  71 +
 tests/e2e/plugins/plugins_suite_test.go   |  29 ++
 tests/e2e/tools/tools.go  | 135 
 10 files changed, 654 insertions(+)

diff --git a/.github/workflows/runner-e2e.yml b/.github/workflows/runner-e2e.yml
new file mode 100644
index 000..30baa22
--- /dev/null
+++ b/.github/workflows/runner-e2e.yml
@@ -0,0 +1,73 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: Runner E2E Test
+
+on:
+  push:
+branches:
+  - main
+  pull_request:
+branches:
+  - main
+
+env:
+  JAVA_RUNNER_VERSION: 0.2.0
+
+
+jobs:
+  run-test:
+runs-on: ubuntu-latest
+steps:
+- name: Check out code
+  uses: actions/checkout@v2
+
+- name: setup go
+  uses: actions/setup-go@v2.1.5
+  with:
+go-version: "1.17"
+
+- name: setup java
+  uses: actions/setup-java@v2
+  with:
+distribution: 'zulu'
+java-version: '11'
+
+- name: build runner
+  run: |
+cp ./sample/src/main/java/org/apache/apisix/plugin/runner/filter/* 
./runner-plugin/src/main/java/org/apache/apisix/plugin/runner/filter/
+./mvnw install
+
+- name: startup runner
+  run: |
+cd dist
+tar -zxvf 
apache-apisix-java-plugin-runner-$JAVA_RUNNER_VERSION-bin.tar.gz
+java -jar -DAPISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock 
-DAPISIX_CONF_EXPIRE_TIME=3600 
./apisix-runner-bin/apisix-java-plugin-runner.jar &
+
+- name: startup apisix
+  run: |
+docker-compose -f ci/docker-compose.yml up -d
+sleep 5
+
+- name: install ginkgo cli
+  run: go install github.com/onsi/ginkgo/ginkgo@v1.16.5
+
+- name: run tests
+  working-directory: ./tests/e2e
+  run: ginkgo -r
diff --git a/.licenserc.yaml b/.licenserc.yaml
index c59dc82..02ddcdc 100644
--- a/.licenserc.yaml
+++ b/.licenserc.yaml
@@ -31,5 +31,7 @@ header:
 - '.github/ISSUE_TEMPLATE'
 - '.github/PULL_REQUEST_TEMPLATE'
 - 'docs/**/**/config.json'
+- '**/go.mod'
+- '**/go.sum'
 
   comment: on-failure
diff --git a/ci/apisix/config.yaml b/ci/apisix/config.yaml
new file mode 100644
index 000..9f480de
--- /dev/null
+++ b/ci/apisix/config.yaml
@@ -0,0 +1,38 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+apisix:
+  allow_admin:
+- 0.0.0.0/0
+  enable_control: true
+  control:
+ip: "0.0.0.0&

[apisix] branch master updated: chore: upgrade PyYAML to 5.4.1 (#6452)

2022-02-26 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new a2882dc  chore: upgrade PyYAML to 5.4.1 (#6452)
a2882dc is described below

commit a2882dce664e030205f593d419fa0837873077c6
Author: Jintao Zhang 
AuthorDate: Sun Feb 27 10:19:39 2022 +0800

chore: upgrade PyYAML to 5.4.1 (#6452)
---
 t/perf/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/perf/requirements.txt b/t/perf/requirements.txt
index 7a997b5..932bd69 100644
--- a/t/perf/requirements.txt
+++ b/t/perf/requirements.txt
@@ -1 +1 @@
-PyYAML==5.3.1
+PyYAML==5.4.1


[apisix] branch release/2.10 updated: chore: backport bugs that related etcd and graphql (#6402)

2022-02-22 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch release/2.10
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/release/2.10 by this push:
 new d926313  chore: backport bugs that related etcd and graphql (#6402)
d926313 is described below

commit d9263132058b4bf7f0615d3ff3e073a89a8f4f39
Author: tzssangglass 
AuthorDate: Tue Feb 22 21:07:24 2022 +0800

chore: backport bugs that related etcd and graphql (#6402)

Co-authored-by: 帅进超 
---
 apisix/cli/etcd.lua| 48 +---
 apisix/core/ctx.lua| 59 --
 apisix/core/request.lua|  1 +
 t/cli/test_etcd_healthcheck.sh | 42 ++--
 t/router/graphql.t | 72 +++---
 5 files changed, 194 insertions(+), 28 deletions(-)

diff --git a/apisix/cli/etcd.lua b/apisix/cli/etcd.lua
index 3cdaaa8..4595ec5 100644
--- a/apisix/cli/etcd.lua
+++ b/apisix/cli/etcd.lua
@@ -32,6 +32,8 @@ local tonumber = tonumber
 local str_format = string.format
 local str_sub = string.sub
 local table_concat = table.concat
+local table_insert = table.insert
+local io_stderr = io.stderr
 
 local _M = {}
 
@@ -187,6 +189,7 @@ function _M.init(env, args)
 end
 
 -- check the etcd cluster version
+local etcd_healthy_hosts = {}
 for index, host in ipairs(yaml_conf.etcd.host) do
 local version_url = host .. "/version"
 local errmsg
@@ -206,29 +209,38 @@ function _M.init(env, args)
  version_url, err, retry_time))
 end
 
-if not res then
-errmsg = str_format("request etcd endpoint \'%s\' error, %s\n", 
version_url, err)
-util.die(errmsg)
-end
+if res then
+local body, _, err = dkjson.decode(res)
+if err or (body and not body["etcdcluster"]) then
+errmsg = str_format("got malformed version message: \"%s\" 
from etcd \"%s\"\n", res,
+version_url)
+util.die(errmsg)
+end
 
-local body, _, err = dkjson.decode(res)
-if err or (body and not body["etcdcluster"]) then
-errmsg = str_format("got malformed version message: \"%s\" from 
etcd \"%s\"\n", res,
-version_url)
-util.die(errmsg)
-end
+local cluster_version = body["etcdcluster"]
+if compare_semantic_version(cluster_version, env.min_etcd_version) 
then
+util.die("etcd cluster version ", cluster_version,
+ " is less than the required version ", 
env.min_etcd_version,
+ ", please upgrade your etcd cluster\n")
+end
 
-local cluster_version = body["etcdcluster"]
-if compare_semantic_version(cluster_version, env.min_etcd_version) then
-util.die("etcd cluster version ", cluster_version,
- " is less than the required version ",
- env.min_etcd_version,
- ", please upgrade your etcd cluster\n")
+table_insert(etcd_healthy_hosts, host)
+else
+io_stderr:write(str_format("request etcd endpoint \'%s\' error, 
%s\n", version_url,
+err))
 end
 end
 
+if #etcd_healthy_hosts <= 0 then
+util.die("all etcd nodes are unavailable\n")
+end
+
+if (#etcd_healthy_hosts / host_count * 100) <= 50 then
+util.die("the etcd cluster needs at least 50% and above healthy 
nodes\n")
+end
+
 local etcd_ok = false
-for index, host in ipairs(yaml_conf.etcd.host) do
+for index, host in ipairs(etcd_healthy_hosts) do
 local is_success = true
 
 local errmsg
@@ -358,7 +370,7 @@ function _M.init(env, args)
 end
 
 if not etcd_ok then
-util.die("none of the configured etcd works well")
+util.die("none of the configured etcd works well\n")
 end
 end
 
diff --git a/apisix/core/ctx.lua b/apisix/core/ctx.lua
index 872a8f6..a9c2913 100644
--- a/apisix/core/ctx.lua
+++ b/apisix/core/ctx.lua
@@ -18,6 +18,7 @@ local core_str = require("apisix.core.string")
 local core_tab = require("apisix.core.table")
 local request  = require("apisix.core.request")
 local log  = require("apisix.core.log")
+local json = require("apisix.core.json")
 local config_local = require("apisix.core.config_local")
 local tablepool= require("tablepool")
 local get_var  = require("re

[apisix-java-plugin-runner] branch main updated: chore: adjust the matching APISIX version to 2.12.0 (#124)

2022-01-26 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 65c6fcd  chore: adjust the matching APISIX version to 2.12.0 (#124)
65c6fcd is described below

commit 65c6fcda68e050fb79e6d935127d5ae7eb65b549
Author: tzssangglass 
AuthorDate: Thu Jan 27 14:28:11 2022 +0800

chore: adjust the matching APISIX version to 2.12.0 (#124)
---
 README.md | 2 +-
 docs/en/latest/development.md | 2 +-
 docs/zh/quick-start.md| 8 
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index c006b7d..0e18ca2 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ Version Matrix
 | apisix-java-plugin-runner | APISIX   
   |
 
|---|-|
 | 0.1.0 | >= 
[2.7.0](https://github.com/apache/apisix/blob/master/CHANGELOG.md#270)   |
-| 0.2.0 | >= 
[2.10.2](https://github.com/apache/apisix/blob/master/CHANGELOG.md#2102) |
+| 0.2.0 | >= 
[2.12.0](https://github.com/apache/apisix/blob/master/CHANGELOG.md#2102) |
 
 How it Works
 -
diff --git a/docs/en/latest/development.md b/docs/en/latest/development.md
index db007a7..339f58f 100644
--- a/docs/en/latest/development.md
+++ b/docs/en/latest/development.md
@@ -29,7 +29,7 @@ Prerequisites
 -
 
 * JDK 11
-* APISIX 2.10.x
+* APISIX 2.12.0
 * Clone the 
[apisix-java-plugin-runner](https://github.com/apache/apisix-java-plugin-runner)
 project.
 * Refer to [Debug](how-it-works.md#debug)  to build the debug environment.
 
diff --git a/docs/zh/quick-start.md b/docs/zh/quick-start.md
index 15d19a7..77bfe58 100644
--- a/docs/zh/quick-start.md
+++ b/docs/zh/quick-start.md
@@ -3,7 +3,7 @@
 ### 准备工作
 
 * JDK 11
-* APISIX 2.10.0
+* APISIX 2.12.0
 * Clone the 
[apisix-java-plugin-runner](https://github.com/apache/apisix-java-plugin-runner)
 project。
 
 ### 开发扩展插件过滤器
@@ -54,7 +54,7 @@ apache-apisix-java-plugin-runner-0.1.0-bin.tar.gz
 在`dist`目录添加`Dockerfile`文件
 
 ```dockerfile
-FROM apache/apisix:2.10.0-alpine
+FROM apache/apisix:${version}-alpine
 
 RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" 
/etc/apk/repositories && apk add --no-cache openjdk8-jre
 
@@ -66,7 +66,7 @@ ADD apache-apisix-java-plugin-runner-0.1.0-bin.tar.gz 
/usr/local/
 
 ```shell
  cd dist
- docker build -t apache/apisix:2.10.0-alpine-with-java-plugin .
+ docker build -t apache/apisix:${version}-alpine-with-java-plugin .
 ```
 
 最后在 APISIX 的 `config.yaml` 文件中增加配置,如下
@@ -76,7 +76,7 @@ ext-plugin:
   cmd: ['java', '-jar', '-Xmx4g', '-Xms4g', 
'/path/to/apisix-runner-bin/apisix-java-plugin-runner.jar']
 ```
 
-构建完成的 `apache/apisix:2.10.0-alpine-with-java-plugin` 镜像内即包含 APISIX 与 
apisix-java-plugun-runner。
+构建完成的 `apache/apisix:${version}-alpine-with-java-plugin` 镜像内即包含 APISIX 与 
apisix-java-plugun-runner。
 
 ### 使用插件
 


[apisix-java-plugin-runner] branch release/0.2.0 created (now cbd3b3a)

2022-01-16 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/0.2.0
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git.


  at cbd3b3a  chore: adjust the directory navigation order of changelog 
(#116)

No new revisions were added by this update.


[apisix-java-plugin-runner] tag 0.2.0 created (now cbd3b3a)

2022-01-16 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to tag 0.2.0
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git.


  at cbd3b3a  (commit)
No new revisions were added by this update.


[apisix-java-plugin-runner] branch release/0.2.0 created (now cbd3b3a)

2022-01-11 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/0.2.0
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git.


  at cbd3b3a  chore: adjust the directory navigation order of changelog 
(#116)

No new revisions were added by this update.


[apisix-java-plugin-runner] branch main updated: chore: adjust the directory navigation order of changelog (#116)

2022-01-11 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new cbd3b3a  chore: adjust the directory navigation order of changelog 
(#116)
cbd3b3a is described below

commit cbd3b3a6ad536df5d1ea71336c4a319a28c0622d
Author: tzssangglass 
AuthorDate: Wed Jan 12 11:09:49 2022 +0800

chore: adjust the directory navigation order of changelog (#116)
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7732c2d..430164e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,8 +23,8 @@ title: Changelog
 
 ## Table of Contents
 
-- [0.1.0](#010)
 - [0.2.0](#020)
+- [0.1.0](#010)
 
 ## 0.2.0
 


[apisix-java-plugin-runner] branch release/0.2 created (now a274712)

2022-01-11 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/0.2
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git.


  at a274712  feat: release 0.2.0 (#115)

No new revisions were added by this update.


[apisix-java-plugin-runner] branch main updated: feat: release 0.2.0 (#115)

2022-01-11 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new a274712  feat: release 0.2.0 (#115)
a274712 is described below

commit a2747125f2e8574ba2c7002bb872de71f7f29397
Author: tzssangglass 
AuthorDate: Tue Jan 11 17:23:14 2022 +0800

feat: release 0.2.0 (#115)
---
 CHANGELOG.md   | 29 ++
 Makefile   |  2 +-
 docs/zh/quick-start.md |  2 +-
 pom.xml|  2 +-
 runner-core/pom.xml|  4 +--
 runner-dist/apisix-runner-bin-dist/pom.xml |  2 +-
 .../src/main/release-docs/LICENSE  |  2 --
 .../licenses/LICENSE-reactive-streams.txt  |  8 --
 runner-dist/apisix-runner-src-dist/pom.xml |  2 +-
 runner-dist/pom.xml|  4 +--
 runner-plugin-sdk/pom.xml  |  2 +-
 runner-plugin/pom.xml  |  4 +--
 runner-starter/pom.xml |  6 ++---
 sample/pom.xml |  4 +--
 14 files changed, 46 insertions(+), 27 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9b6ea3d..7732c2d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,35 @@ title: Changelog
 ## Table of Contents
 
 - [0.1.0](#010)
+- [0.2.0](#020)
+
+## 0.2.0
+
+This release mainly provides the ability to get variables and request body.
+
+### Change
+
+- change the network communication framework from reactor-netty to netty. 
[100](https://github.com/apache/apisix-java-plugin-runner/pull/100)
+- change the return value of filter function in PluginFilter interface. 
[100](https://github.com/apache/apisix-java-plugin-runner/pull/100)
+- the requiredVars and requiredBody functions have been added to the 
PluginFilter interface. 
[100](https://github.com/apache/apisix-java-plugin-runner/pull/100)
+- JDK requirements upgrade from 8 to 11.
+
+### Core
+
+- support for getting variables and request body. 
[100](https://github.com/apache/apisix-java-plugin-runner/pull/100)
+- catching exceptions thrown during the writeAndFlush. 
[107](https://github.com/apache/apisix-java-plugin-runner/pull/107)
+
+### Bugfix
+
+- chinese encoding in the response body. 
[#53](https://github.com/apache/apisix-java-plugin-runner/pull/53)
+- stop request but not setStatusCode will trigger an exception In APISIX. 
[#56](https://github.com/apache/apisix-java-plugin-runner/pull/56)
+- reset vtable_start and vtable_size of PrepareConf/Req. 
[#66](https://github.com/apache/apisix-java-plugin-runner/pull/66)
+- convert the conf req to an object and put it in the cache. 
[#73](https://github.com/apache/apisix-java-plugin-runner/pull/73)
+- modify socket file permissions so that APISIX has permission to read and 
write. [#96](https://github.com/apache/apisix-java-plugin-runner/pull/96)
+- disable null as key of req/resp headers and args. 
[#105](https://github.com/apache/apisix-java-plugin-runner/pull/105)
+- pre-read requests prevent read/write index confusion. 
[#113](https://github.com/apache/apisix-java-plugin-runner/pull/113)
+
+[Back to TOC](#table-of-contents)
 
 ## 0.1.0
 
diff --git a/Makefile b/Makefile
index a7de5e6..d95db7a 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
 
 SHELL := /bin/bash -o pipefail
 
-VERSION ?= 0.1.0
+VERSION ?= 0.2.0
 RELEASE_SRC = apisix-java-plugin-runner-${VERSION}-src
 
 .PHONY: release-src
diff --git a/docs/zh/quick-start.md b/docs/zh/quick-start.md
index a5f2dd5..15d19a7 100644
--- a/docs/zh/quick-start.md
+++ b/docs/zh/quick-start.md
@@ -2,7 +2,7 @@
 
 ### 准备工作
 
-* JDK 8
+* JDK 11
 * APISIX 2.10.0
 * Clone the 
[apisix-java-plugin-runner](https://github.com/apache/apisix-java-plugin-runner)
 project。
 
diff --git a/pom.xml b/pom.xml
index 6c7a37f..8aaecd2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.1.0
+0.2.0
 
 
 org.apache
diff --git a/runner-core/pom.xml b/runner-core/pom.xml
index a1b03dc..6336a45 100644
--- a/runner-core/pom.xml
+++ b/runner-core/pom.xml
@@ -24,7 +24,7 @@
 
 org.apache.apisix
 apisix-plugin-runner
-0.1.0
+0.2.0
 
 
 apisix-runner-core
@@ -36,7 +36,7 @@
 
 org.apache.apisix
 apisix-runner-plugin
-0.1.0
+0.2.0
 
 
 org.springframework.boot
diff --git a/runner-dist/apisix-runner-bin-dist/pom.xml 
b/runner-dist/apisix-runner-bin-dist/pom.xml
index e550349..7f02304 100644
--- a/runner-dist/apisix-runner-bin-dist/pom.xml
+++ b/runner-dist/apisix-runner-bin-dist/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.apisix

[apisix-java-plugin-runner] branch main updated: chore: update copyright to 2022 (#114)

2022-01-10 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 91718ab  chore: update copyright to 2022 (#114)
91718ab is described below

commit 91718ab9450e62e607ccec74ffb311f8576bef8e
Author: tzssangglass 
AuthorDate: Tue Jan 11 14:11:40 2022 +0800

chore: update copyright to 2022 (#114)

Co-authored-by: hf400159 <97138894+hf400...@users.noreply.github.com>
---
 NOTICE  | 2 +-
 runner-dist/apisix-runner-bin-dist/src/main/release-docs/NOTICE | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/NOTICE b/NOTICE
index 11cb82a..3e34df0 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 Apache APISIX
-Copyright 2017-2021 The Apache Software Foundation
+Copyright 2021-2022 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
diff --git a/runner-dist/apisix-runner-bin-dist/src/main/release-docs/NOTICE 
b/runner-dist/apisix-runner-bin-dist/src/main/release-docs/NOTICE
index 803ad07..e2da666 100644
--- a/runner-dist/apisix-runner-bin-dist/src/main/release-docs/NOTICE
+++ b/runner-dist/apisix-runner-bin-dist/src/main/release-docs/NOTICE
@@ -1,5 +1,5 @@
 Apache APISIX
-Copyright 2017-2021 The Apache Software Foundation
+Copyright 2021-2022 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).


[apisix-java-plugin-runner] branch patch-1 created (now 6a84c12)

2022-01-10 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch patch-1
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git.


  at 6a84c12  fix code resolve

No new revisions were added by this update.


[apisix-java-plugin-runner] branch main updated: fix: pre-read requests prevent read/write index confusion (#113)

2022-01-10 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 1a68261  fix: pre-read requests prevent read/write index confusion 
(#113)
1a68261 is described below

commit 1a682617a12a2350370f9bf5d6daa3f0bf11f099
Author: tzssangglass 
AuthorDate: Tue Jan 11 10:31:19 2022 +0800

fix: pre-read requests prevent read/write index confusion (#113)
---
 .../apisix/plugin/runner/handler/HTTPReqCallHandler.java | 12 
 .../apache/apisix/plugin/runner/handler/ExtraInfoTest.java   |  5 -
 .../java/org/apache/apisix/plugin/runner/HttpRequest.java|  5 -
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java
index 439c582..2152703 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java
@@ -142,6 +142,10 @@ public class HTTPReqCallHandler extends 
SimpleChannelInboundHandler {
 
 PluginFilterChain chain = conf.getChain();
 
+// here we pre-read parameters in the req to
+// prevent confusion over the read/write index of the req.
+preReadReq();
+
 // if the filter chain is empty, then return the response directly
 if (Objects.isNull(chain) || 0 == chain.getFilters().size()) {
 ChannelFuture future = ctx.writeAndFlush(currResp);
@@ -194,6 +198,14 @@ public class HTTPReqCallHandler extends 
SimpleChannelInboundHandler {
 }
 }
 
+private void preReadReq() {
+currReq.getHeader();
+currReq.getPath();
+currReq.getMethod();
+currReq.getArgs();
+currReq.getSourceIP();
+}
+
 private void errorHandle(ChannelHandlerContext ctx, int code) {
 A6ErrResponse errResponse = new A6ErrResponse(code);
 ctx.writeAndFlush(errResponse);
diff --git 
a/runner-core/src/test/java/org/apache/apisix/plugin/runner/handler/ExtraInfoTest.java
 
b/runner-core/src/test/java/org/apache/apisix/plugin/runner/handler/ExtraInfoTest.java
index 51daa05..b564597 100644
--- 
a/runner-core/src/test/java/org/apache/apisix/plugin/runner/handler/ExtraInfoTest.java
+++ 
b/runner-core/src/test/java/org/apache/apisix/plugin/runner/handler/ExtraInfoTest.java
@@ -204,7 +204,7 @@ class ExtraInfoTest {
 }
 
 @Test
-@DisplayName("test fetch request body of extra info")
+@DisplayName("test get vars in plugin filter")
 void testGetVarsInPluginFilter() {
 FlatBufferBuilder builder = new FlatBufferBuilder();
 
@@ -276,6 +276,9 @@ class ExtraInfoTest {
 Assertions.assertTrue(bytes.toString().contains("server_port: 9080"));
 Assertions.assertTrue(bytes.toString().contains("content_type: 
application/json"));
 Assertions.assertTrue(bytes.toString().contains("body: abcd"));
+
+// test pre-read request in HttpCallHandler
+Assertions.assertEquals(HttpRequest.Method.GET, request.getMethod());
 }
 
 }
diff --git 
a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java
 
b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java
index 38d0212..d4f75b4 100644
--- 
a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java
+++ 
b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpRequest.java
@@ -21,6 +21,7 @@ import io.github.api7.A6.HTTPReqCall.Req;
 import io.github.api7.A6.TextEntry;
 import org.apache.apisix.plugin.runner.filter.PluginFilter;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 
 import java.nio.ByteBuffer;
 import java.util.HashMap;
@@ -84,7 +85,9 @@ public class HttpRequest implements A6Request {
 for (int i = 0; i < req.srcIpLength(); i++) {
 builder.append(req.srcIp(i)).append('.');
 }
-sourceIP = builder.substring(0, builder.length() - 1);
+if (StringUtils.hasText(builder.toString())) {
+sourceIP = builder.substring(0, builder.length() - 1);
+}
 }
 
 return sourceIP;


[apisix-java-plugin-runner] branch main updated: feat: catching exceptions thrown during the writeAndFlush (#107)

2022-01-03 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new d9b9214  feat: catching exceptions thrown during the writeAndFlush 
(#107)
d9b9214 is described below

commit d9b92146affea4ddb19e43d1db9a94fc4aa4b4eb
Author: tzssangglass 
AuthorDate: Tue Jan 4 14:00:39 2022 +0800

feat: catching exceptions thrown during the writeAndFlush (#107)
---
 .../runner/handler/ExceptionCaughtHandler.java | 36 ++
 .../plugin/runner/handler/HTTPReqCallHandler.java  | 15 ++---
 .../plugin/runner/server/ApplicationRunner.java| 34 ++--
 .../runner/handler/A6HttpCallHandlerTest.java  |  2 --
 4 files changed, 65 insertions(+), 22 deletions(-)

diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/ExceptionCaughtHandler.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/ExceptionCaughtHandler.java
new file mode 100644
index 000..fb6bfe5
--- /dev/null
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/ExceptionCaughtHandler.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.apisix.plugin.runner.handler;
+
+import io.github.api7.A6.Err.Code;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandlerAdapter;
+import org.apache.apisix.plugin.runner.A6ErrResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ExceptionCaughtHandler extends ChannelInboundHandlerAdapter {
+private final Logger logger = 
LoggerFactory.getLogger(ExceptionCaughtHandler.class);
+
+@Override
+public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) 
throws Exception {
+logger.error("handle request error: ", cause);
+A6ErrResponse errResponse = new 
A6ErrResponse(Code.SERVICE_UNAVAILABLE);
+ctx.writeAndFlush(errResponse);
+}
+}
diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java
index 4cef266..439c582 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/HTTPReqCallHandler.java
@@ -28,6 +28,8 @@ import java.util.Set;
 
 import com.google.common.cache.Cache;
 import io.github.api7.A6.Err.Code;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelFutureListener;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.SimpleChannelInboundHandler;
 import org.slf4j.Logger;
@@ -118,7 +120,9 @@ public class HTTPReqCallHandler extends 
SimpleChannelInboundHandler {
 PluginFilterChain chain = conf.getChain();
 chain.filter(currReq, currResp);
 
-ctx.writeAndFlush(currResp);
+ChannelFuture future = ctx.writeAndFlush(currResp);
+future.addListeners(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
+
 }
 
 private void handleHttpReqCall(ChannelHandlerContext ctx, HttpRequest 
request) {
@@ -140,7 +144,8 @@ public class HTTPReqCallHandler extends 
SimpleChannelInboundHandler {
 
 // if the filter chain is empty, then return the response directly
 if (Objects.isNull(chain) || 0 == chain.getFilters().size()) {
-ctx.writeAndFlush(currResp);
+ChannelFuture future = ctx.writeAndFlush(currResp);
+
future.addListeners(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
 return;
 }
 
@@ -170,7 +175,8 @@ public class HTTPReqCallHandler extends 
SimpleChannelInboundHandler {
 return;
 }
 ExtraInfoRequest extraInfoRequest = new 
ExtraInfoRequest(varKey, null);
-ctx.writeAndFlush(extraInfoRequest);
+ChannelFuture future = ctx.writeAndFlush(extraInfoRequest);
+  

[apisix-java-plugin-runner] branch main updated: docs: adding function definitions for the PluginFilter interface (#108)

2022-01-03 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 6197a8e  docs: adding function definitions for the PluginFilter 
interface (#108)
6197a8e is described below

commit 6197a8e5196b25bf556eaf8a7d2eb7a25053ab57
Author: tzssangglass 
AuthorDate: Tue Jan 4 09:20:47 2022 +0800

docs: adding function definitions for the PluginFilter interface (#108)
---
 README.md  |  8 +++-
 docs/en/latest/development.md  | 68 ++
 docs/zh/{Quick Start.md => quick-start.md} |  0
 3 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index d68789c..c006b7d 100644
--- a/README.md
+++ b/README.md
@@ -20,9 +20,15 @@ security, traffic control, serverless, analytics & 
monitoring, transformations,
 It also provides highly extensible API, allowing common phases to be mounted,
 and users can use these api to develop their own plugins.
 
-APISIX supports writing plugins in multiple languages in version 
[2.7.0](https://github.com/apache/apisix/blob/master/CHANGELOG.md#270),
 this project is APISIX Java side implementation that supports writing plugins 
in java.
 
+Version Matrix
+-
+
+| apisix-java-plugin-runner | APISIX   
   |
+|---|-|
+| 0.1.0 | >= 
[2.7.0](https://github.com/apache/apisix/blob/master/CHANGELOG.md#270)   |
+| 0.2.0 | >= 
[2.10.2](https://github.com/apache/apisix/blob/master/CHANGELOG.md#2102) |
 
 How it Works
 -
diff --git a/docs/en/latest/development.md b/docs/en/latest/development.md
index 1eeaa1a..db007a7 100644
--- a/docs/en/latest/development.md
+++ b/docs/en/latest/development.md
@@ -87,6 +87,74 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 
'X-API-KEY: edd1c9f034335f13
 apisix-java-plugin-runner will look for implementation classes named 
`FooFilter`,
 and the name of each filter's implementation class is the return value of its 
overridden function `public String name()`.
 
+ The functions must be implemented of filter execution
+
+- `String name();`
+
+  description: return the name of plugin filter
+
+  code example:
+  
+  ```java
+@Override
+public String name() {
+return "FooFilter";
+}
+  ```
+
+- `void filter(HttpRequest request, HttpResponse response, PluginFilterChain 
chain);`
+
+  description: implementing custom business logic
+
+  code example:
+
+  ```java
+@Override
+public void filter(HttpRequest request, HttpResponse response, 
PluginFilterChain chain) {
+// get conf of current filter
+String configStr = request.getConfig(this);
+Gson gson = new Gson();
+Map conf = new HashMap<>();
+// convert according to the actual configured conf type
+conf = gson.fromJson(configStr, conf.getClass());
+  
+// get extra info
+String remoteAddr = request.getVars("remote_addr");
+String serverPort = request.getVars("server_port");
+String body = request.getBody();
+
+chain.filter(request, response);
+}
+  ```
+
+- `List requiredVars();`
+
+  description: declare in advance the nginx variables you want to use in the 
current filter
+
+  code example:
+
+  ```java
+@Override
+public List requiredVars() {
+List vars = new ArrayList<>();
+vars.add("remote_addr");
+vars.add("server_port");
+return vars;
+}
+  ```
+
+- `Boolean requiredBody();`
+
+  description: whether the request body is required in the current filter, 
true means yes.
+
+  code example:
+
+  ```java
+@Override
+public Boolean requiredBody() {
+return true;
+}
+  ```
 
   Rewrite Request
 
diff --git a/docs/zh/Quick Start.md b/docs/zh/quick-start.md
similarity index 100%
rename from docs/zh/Quick Start.md
rename to docs/zh/quick-start.md


[apisix-java-plugin-runner] branch main updated: chore: support run on macos (#103)

2021-12-31 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 3da21b9  chore: support run on macos (#103)
3da21b9 is described below

commit 3da21b98fc435dc239af6f1d8a9ceebdd6f1686f
Author: tzssangglass 
AuthorDate: Fri Dec 31 20:25:30 2021 +0800

chore: support run on macos (#103)
---
 .../plugin/runner/server/ApplicationRunner.java| 50 ++
 .../src/main/resources/application.properties  |  4 +-
 .../plugin/runner/filter/PluginFilterChain.java|  3 --
 3 files changed, 33 insertions(+), 24 deletions(-)

diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java
index 2d3fc20..169fff1 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java
@@ -22,8 +22,12 @@ import io.netty.bootstrap.ServerBootstrap;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelInitializer;
 import io.netty.channel.EventLoopGroup;
+import io.netty.channel.epoll.Epoll;
 import io.netty.channel.epoll.EpollEventLoopGroup;
 import io.netty.channel.epoll.EpollServerDomainSocketChannel;
+import io.netty.channel.kqueue.KQueue;
+import io.netty.channel.kqueue.KQueueEventLoopGroup;
+import io.netty.channel.kqueue.KQueueServerDomainSocketChannel;
 import io.netty.channel.unix.DomainSocketAddress;
 import io.netty.channel.unix.DomainSocketChannel;
 import io.netty.handler.logging.LoggingHandler;
@@ -84,10 +88,22 @@ public class ApplicationRunner implements CommandLineRunner 
{
 }
 
 public void start(String path) throws Exception {
-EventLoopGroup group = new EpollEventLoopGroup();
+EventLoopGroup group;
+ServerBootstrap bootstrap = new ServerBootstrap();
+if (KQueue.isAvailable()) {
+group = new KQueueEventLoopGroup();
+
bootstrap.group(group).channel(KQueueServerDomainSocketChannel.class);
+} else if (Epoll.isAvailable()) {
+group = new EpollEventLoopGroup();
+
bootstrap.group(group).channel(EpollServerDomainSocketChannel.class);
+} else {
+String errMsg = "java runner is only support epoll or kqueue";
+logger.warn(errMsg);
+throw new RuntimeException(errMsg);
+}
+
 try {
-ServerBootstrap bootstrap = new ServerBootstrap();
-initServerBootstrap(group, bootstrap);
+initServerBootstrap(bootstrap);
 ChannelFuture future = bootstrap.bind(new 
DomainSocketAddress(path)).sync();
 Runtime.getRuntime().exec("chmod 777 " + socketFile);
 logger.warn("java runner is listening on the socket file: {}", 
socketFile);
@@ -98,21 +114,19 @@ public class ApplicationRunner implements 
CommandLineRunner {
 }
 }
 
-private ServerBootstrap initServerBootstrap(EventLoopGroup group, 
ServerBootstrap bootstrap) {
-return bootstrap.group(group)
-.channel(EpollServerDomainSocketChannel.class)
-.childHandler(new ChannelInitializer() {
-@Override
-protected void initChannel(DomainSocketChannel channel) {
-channel.pipeline().addFirst("logger", new 
LoggingHandler())
-.addAfter("logger", "payloadEncoder", new 
PayloadEncoder())
-.addAfter("payloadEncoder", "delayedDecoder", 
new BinaryProtocolDecoder())
-.addLast("payloadDecoder", new 
PayloadDecoder())
-.addAfter("payloadDecoder", 
"prepareConfHandler", createConfigReqHandler(cache, beanProvider))
-.addAfter("prepareConfHandler", 
"hTTPReqCallHandler", createA6HttpHandler(cache));
-
-}
-});
+private void initServerBootstrap(ServerBootstrap bootstrap) {
+bootstrap.childHandler(new ChannelInitializer() {
+@Override
+protected void initChannel(DomainSocketChannel channel) {
+channel.pipeline().addFirst("logger", new LoggingHandler())
+.addAfter("logger", "payloadEncoder", new 
PayloadEncoder())
+.addAfter("payloadEncoder", "delayedDecoder", new 
BinaryProtocolDecoder())
+.addLast("payloadDecoder", new PayloadDecoder())
+.addA

[apisix-java-plugin-runner] branch main updated: chore: upgrade log4j2 version to 2.17.1 (#104)

2021-12-31 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 0d15720  chore: upgrade log4j2 version to 2.17.1 (#104)
0d15720 is described below

commit 0d15720becb1344b86cdbb6a09b8bd8cfa059e74
Author: tzssangglass 
AuthorDate: Fri Dec 31 20:25:16 2021 +0800

chore: upgrade log4j2 version to 2.17.1 (#104)
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 0e07808..6c7a37f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -77,7 +77,7 @@
 
 org.apache.logging.log4j
 log4j-bom
-2.17.0
+2.17.1
 pom
 import
 


[apisix-java-plugin-runner] branch main updated: fix: disable null as key of req/resp headers and args (#105)

2021-12-31 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 1fcc377  fix: disable null as key of req/resp headers and args (#105)
1fcc377 is described below

commit 1fcc377f14926c2270109a3b79afbc902af9bb0f
Author: tzssangglass 
AuthorDate: Fri Dec 31 20:25:00 2021 +0800

fix: disable null as key of req/resp headers and args (#105)
---
 .../plugin/runner/codec/impl/PayloadEncoderTest.java| 17 +
 .../org/apache/apisix/plugin/runner/HttpResponse.java   | 15 +++
 2 files changed, 32 insertions(+)

diff --git 
a/runner-core/src/test/java/org/apache/apisix/plugin/runner/codec/impl/PayloadEncoderTest.java
 
b/runner-core/src/test/java/org/apache/apisix/plugin/runner/codec/impl/PayloadEncoderTest.java
index bde4d21..4231e9c 100644
--- 
a/runner-core/src/test/java/org/apache/apisix/plugin/runner/codec/impl/PayloadEncoderTest.java
+++ 
b/runner-core/src/test/java/org/apache/apisix/plugin/runner/codec/impl/PayloadEncoderTest.java
@@ -33,6 +33,7 @@ import org.junit.jupiter.api.Test;
 import org.springframework.test.util.ReflectionTestUtils;
 
 import java.nio.ByteBuffer;
+import java.util.HashMap;
 
 @DisplayName("test encode data")
 class PayloadEncoderTest {
@@ -285,4 +286,20 @@ class PayloadEncoderTest {
 }
 }
 }
+
+@Test
+@DisplayName("test set the parameter of the rewrite request to null")
+void testHttpResponseNPE() {
+HttpResponse httpResponse = new HttpResponse(0L);
+// HashMap accepts null as key and value, but we want to disable null 
as key
+httpResponse.setArg(null, null);
+httpResponse.setReqHeader(null, null);
+httpResponse.setHeader(null, null);
+HashMap reqHeaders = (HashMap) 
ReflectionTestUtils.getField(httpResponse, "reqHeaders");
+HashMap args = (HashMap) 
ReflectionTestUtils.getField(httpResponse, "args");
+HashMap respHeaders = (HashMap) 
ReflectionTestUtils.getField(httpResponse, "respHeaders");
+Assertions.assertNull(reqHeaders);
+Assertions.assertNull(args);
+Assertions.assertNull(respHeaders);
+}
 }
diff --git 
a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpResponse.java
 
b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpResponse.java
index 9aa2e62..410715e 100644
--- 
a/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpResponse.java
+++ 
b/runner-plugin-sdk/src/main/java/org/apache/apisix/plugin/runner/HttpResponse.java
@@ -67,6 +67,12 @@ public class HttpResponse implements A6Response {
 }
 
 public void setReqHeader(String headerKey, String headerValue) {
+// key is null will cause the request to block
+if (headerKey == null) {
+logger.warn("headerKey is null, ignore it");
+return;
+}
+
 actionType = ActionType.Rewrite;
 if (Objects.isNull(reqHeaders)) {
 reqHeaders = new HashMap<>();
@@ -81,6 +87,10 @@ public class HttpResponse implements A6Response {
  * @param argValue the arg value
  */
 public void setArg(String argKey, String argValue) {
+if (argKey == null) {
+logger.warn("argKey is null, ignore it");
+return;
+}
 actionType = ActionType.Rewrite;
 if (Objects.isNull(args)) {
 args = new HashMap<>();
@@ -105,6 +115,11 @@ public class HttpResponse implements A6Response {
  * @param headerValue the header value
  */
 public void setHeader(String headerKey, String headerValue) {
+if (headerKey == null) {
+logger.warn("headerKey is null, ignore it");
+return;
+}
+
 actionType = ActionType.Stop;
 if (Objects.isNull(respHeaders)) {
 respHeaders = new HashMap<>();


[apisix-java-plugin-runner] branch main updated: refactor: switch from reactor-netty to netty, and support fetching var and body (#100)

2021-12-29 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new f0ef4b7  refactor: switch from reactor-netty to netty, and support 
fetching var and body (#100)
f0ef4b7 is described below

commit f0ef4b7758188ccae3bcf35a6b95f2459180f3c9
Author: tzssangglass 
AuthorDate: Thu Dec 30 15:55:27 2021 +0800

refactor: switch from reactor-netty to netty, and support fetching var and 
body (#100)
---
 .github/workflows/ci.yaml  |  10 +-
 docs/en/latest/development.md  |   4 +-
 .../the-internal-of-apisix-java-plugin-runner.md   |   2 +-
 pom.xml|   6 +-
 runner-core/pom.xml|  23 +-
 .../runner/codec/PluginRunnerConfiguration.java|  38 ---
 .../A6HandlerConfiguration.java}   |   5 +-
 .../Constants.java}|  13 +-
 .../runner/handler/A6HandlerConfiguration.java |  85 ---
 .../plugin/runner/handler/A6HttpCallHandler.java   |  60 -
 .../BinaryProtocolDecoder.java}|   6 +-
 .../apisix/plugin/runner/handler/Dispatcher.java   |  26 --
 .../plugin/runner/handler/HTTPReqCallHandler.java  | 202 +++
 .../apisix/plugin/runner/handler/Handler.java  |  26 --
 .../apisix/plugin/runner/handler/IOHandler.java|  44 
 .../runner/handler/IOHandlerConfiguration.java |  34 ---
 .../PayloadDecoder.java}   |  42 ++-
 .../PayloadEncoder.java}   |  23 +-
 ...6ConfigHandler.java => PrepareConfHandler.java} |  24 +-
 .../plugin/runner/server/ApplicationRunner.java| 119 ++---
 .../server/config/TcpServerConfiguration.java  |  44 
 .../runner/server/config/TcpServerCustomizer.java  |  27 --
 .../src/main/resources/application.properties  |  21 ++
 ...ersDecoderTest.java => PayloadDecoderTest.java} |  23 +-
 ...ersEncoderTest.java => PayloadEncoderTest.java} |  32 +--
 .../plugin/runner/handler/A6ConfigHandlerTest.java |  76 --
 .../runner/handler/A6HttpCallHandlerTest.java  |  85 +--
 .../plugin/runner/handler/ExtraInfoTest.java   | 281 +
 .../src/main/release-docs/LICENSE  |   3 +-
 runner-plugin-sdk/pom.xml  |  12 +-
 .../apisix/plugin/runner/ExtraInfoRequest.java |  70 +
 .../apisix/plugin/runner/ExtraInfoResponse.java|  34 ++-
 .../apache/apisix/plugin/runner/HttpRequest.java   |  28 +-
 .../apache/apisix/plugin/runner/HttpResponse.java  |  14 -
 .../apisix/plugin/runner/filter/PluginFilter.java  |  26 +-
 .../plugin/runner/filter/PluginFilterChain.java|   8 +-
 runner-plugin/pom.xml  |   4 -
 .../plugin/runner/PluginRunnerApplicationTest.java |  75 --
 sample/pom.xml |   4 -
 .../runner/filter/RewriteRequestDemoFilter.java|  34 ++-
 .../runner/filter/StopRequestDemoFilter.java   |  16 +-
 .../runner/filter/StopRequestDemoFilterTest.java   |  30 ---
 src/main/checkstyle/checkstyle-suppressions.xml|   8 +-
 43 files changed, 1026 insertions(+), 721 deletions(-)

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 8c2c832..f7582a7 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -32,9 +32,10 @@ jobs:
   fail-fast: true
 steps:
   - uses: actions/checkout@v2
-  - uses: actions/setup-java@v1
+  - uses: actions/setup-java@v2
 with:
-  java-version: 8
+  distribution: 'zulu'
+  java-version: '11'
   - name: Check License Header
 uses: apache/skywalking-eyes@main
 env:
@@ -49,8 +50,9 @@ jobs:
   fail-fast: true
 steps:
   - uses: actions/checkout@v2
-  - uses: actions/setup-java@v1
+  - uses: actions/setup-java@v2
 with:
-  java-version: 8
+  distribution: 'zulu'
+  java-version: '11'
   - name: 'Install & Test'
 run: ./mvnw clean install
diff --git a/docs/en/latest/development.md b/docs/en/latest/development.md
index f2eaccb..1eeaa1a 100644
--- a/docs/en/latest/development.md
+++ b/docs/en/latest/development.md
@@ -28,8 +28,8 @@ This document explains how to get started to develop the 
apisix-java-plugin-runn
 Prerequisites
 -
 
-* JDK 8
-* APISIX 2.7.0
+* JDK 11
+* APISIX 2.10.x
 * Clone the 
[apisix-java-plugin-runner](https://github.com/apache/apisix-java-plugin-runner)
 project.
 * Refer to [Debug](how-it-works.md#debug)  to build the debug environment.
 
diff --git a/docs/en/latest/the-internal-of-apisix-java-plugin-runner.md 
b/docs/en/latest/the-internal-of-apisix-java-plugin-runner.md
index a67fc3e..b8e776d

[apisix-java-plugin-runner] branch main updated (82bef6b -> d5adbe0)

2021-12-17 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git.


from 82bef6b  chore: upgrade log4j2 version to 2.16.0 (#99)
 add d5adbe0  docs: add zh Quick Start (#95)

No new revisions were added by this update.

Summary of changes:
 docs/zh/Quick Start.md | 112 +
 1 file changed, 112 insertions(+)
 create mode 100644 docs/zh/Quick Start.md


[apisix-java-plugin-runner] branch main updated: chore: upgrade log4j2 version to 2.15.0 (#98)

2021-12-12 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 8b89e33  chore: upgrade log4j2 version to 2.15.0 (#98)
8b89e33 is described below

commit 8b89e339b991ac571bcc6242c0bc468bc4e5a2d9
Author: Daming 
AuthorDate: Mon Dec 13 10:26:38 2021 +0800

chore: upgrade log4j2 version to 2.15.0 (#98)
---
 pom.xml | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/pom.xml b/pom.xml
index ffd085c..5178f67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,6 +75,13 @@
 
 
 
+org.apache.logging.log4j
+log4j-bom
+2.15.0
+pom
+import
+
+
 org.springframework.boot
 spring-boot-dependencies
 ${spring-boot.version}


[apisix-java-plugin-runner] branch main updated: fix: modify socket file permissions so that APISIX has permission to read and write (#96)

2021-12-09 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new fc3477e  fix: modify socket file permissions so that APISIX has 
permission to read and write (#96)
fc3477e is described below

commit fc3477eebdc3e002deda68611a3d53efc6435039
Author: 寒风 <33853061+aa57255...@users.noreply.github.com>
AuthorDate: Thu Dec 9 21:36:16 2021 +0800

fix: modify socket file permissions so that APISIX has permission to read 
and write (#96)

Co-authored-by: 刘朋 
---
 .../java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java   | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java
index 5b0f889..85acabc 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/server/ApplicationRunner.java
@@ -83,5 +83,6 @@ public class ApplicationRunner implements CommandLineRunner {
 awaitThread.setDaemon(false);
 awaitThread.setName("uds-server");
 awaitThread.start();
+Runtime.getRuntime().exec("chmod 777 " + socketFile);
 }
 }


[apisix-docker] branch release/apisix-2.10.2 created (now 829d455)

2021-11-22 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch release/apisix-2.10.2
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git.


  at 829d455  feat: upgrade APISIX to 2.10.2 (#247)

No new revisions were added by this update.


[apisix] tag 2.10.2 created (now 19587ed)

2021-11-19 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to tag 2.10.2
in repository https://gitbox.apache.org/repos/asf/apisix.git.


  at 19587ed  (commit)
No new revisions were added by this update.


[apisix-java-plugin-runner] branch main updated: fix(sample): StopRequestDemoFilter (#74)

2021-10-18 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new feac053  fix(sample): StopRequestDemoFilter (#74)
feac053 is described below

commit feac0530a29a51a70acf7120e4059e8bf4dc9f4b
Author: Hugo-X 
AuthorDate: Tue Oct 19 11:34:23 2021 +0800

fix(sample): StopRequestDemoFilter (#74)
---
 sample/pom.xml | 21 +-
 .../runner/filter/StopRequestDemoFilter.java   |  2 +-
 .../runner/filter/StopRequestDemoFilterTest.java   | 87 ++
 3 files changed, 108 insertions(+), 2 deletions(-)

diff --git a/sample/pom.xml b/sample/pom.xml
index 313fd60..466d756 100644
--- a/sample/pom.xml
+++ b/sample/pom.xml
@@ -49,5 +49,24 @@
 io.projectreactor
 reactor-core
 
+
+org.springframework.boot
+spring-boot-starter-test
+test
+
+
+org.junit.vintage
+junit-vintage-engine
+
+
+ch.qos.logback
+logback-classic
+
+
+org.apache.logging.log4j
+log4j-to-slf4j
+
+
+
 
-
\ No newline at end of file
+
diff --git 
a/sample/src/main/java/org/apache/apisix/plugin/runner/filter/StopRequestDemoFilter.java
 
b/sample/src/main/java/org/apache/apisix/plugin/runner/filter/StopRequestDemoFilter.java
index 97ae800..706e573 100644
--- 
a/sample/src/main/java/org/apache/apisix/plugin/runner/filter/StopRequestDemoFilter.java
+++ 
b/sample/src/main/java/org/apache/apisix/plugin/runner/filter/StopRequestDemoFilter.java
@@ -47,7 +47,7 @@ public class StopRequestDemoFilter implements PluginFilter {
 /*
  * You can use the parameters in the configuration.
  */
-response.setStatusCode((Integer) conf.get("stop_response_code"));
+
response.setStatusCode(Double.valueOf(conf.get("stop_response_code").toString()).intValue());
 
 response.setHeader((String) conf.get("stop_response_header_name"), 
(String) conf.get("stop_response_header_value"));
 /* note: The body is currently a string type.
  If you need the json type, you need to escape the json 
content here.
diff --git 
a/sample/src/test/java/org/apache/apisix/plugin/runner/filter/StopRequestDemoFilterTest.java
 
b/sample/src/test/java/org/apache/apisix/plugin/runner/filter/StopRequestDemoFilterTest.java
new file mode 100644
index 000..88dfbb6
--- /dev/null
+++ 
b/sample/src/test/java/org/apache/apisix/plugin/runner/filter/StopRequestDemoFilterTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.apisix.plugin.runner.filter;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.google.gson.Gson;
+
+import org.apache.apisix.plugin.runner.HttpRequest;
+import org.apache.apisix.plugin.runner.HttpResponse;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+public class StopRequestDemoFilterTest {
+
+@Test
+@DisplayName("test stop response code of config string")
+void testConfigStringResponseCodeConverter() {
+
+String configStr;
+
+Gson gson = new Gson();
+Map conf = new HashMap();
+
+configStr = "{\"stop_response_code\": 200, 
\"stop_response_header_name\": \"header_java_runner\", 
\"stop_response_header_value\": \"via-java-runner\",  \"stop_response_body\": 
\"hellox\"}";
+conf = gson.fromJson(configStr, conf.getClass());
+Assertions.assertTrue(conf.get("stop_response_code") instanceof 
Double);
+
Assertions.assertTrue(Double.valueOf(conf.get("

[apisix] 02/02: resolve code review

2021-09-26 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch patch-1
in repository https://gitbox.apache.org/repos/asf/apisix.git

commit b3bf9fa1b6e1b0e7a80a16d7c3d1f1e39db83d18
Author: tzssangglass 
AuthorDate: Mon Sep 27 09:32:23 2021 +0800

resolve code review

Signed-off-by: tzssangglass 
---
 docs/en/latest/architecture-design/global-rule.md | 2 ++
 docs/zh/latest/architecture-design/global-rule.md | 5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/docs/en/latest/architecture-design/global-rule.md 
b/docs/en/latest/architecture-design/global-rule.md
index e27b629..7057d6a 100644
--- a/docs/en/latest/architecture-design/global-rule.md
+++ b/docs/en/latest/architecture-design/global-rule.md
@@ -24,6 +24,8 @@ title: Global rule
 [Plugin](plugin.md) just can be bound to [Service](service.md) or 
[Route](route.md), if we want a [Plugin](plugin.md) work on all requests, how 
to do it?
 We can register a global [Plugin](plugin.md) with `GlobalRule`:
 
+When the same plugin is enabled on both `Route` and `Service`, APISIX will 
only execute the plugin on `Route` and the plugin on `Service` is overwritten. 
But the plugin on `GlobalRule` will always be executed, regardless of whether 
the same plugin is enabled on `Route` and `Service`.
+
 ```shell
 curl -X PUT \
   https://{apisix_listen_address}/apisix/admin/global_rules/1 \
diff --git a/docs/zh/latest/architecture-design/global-rule.md 
b/docs/zh/latest/architecture-design/global-rule.md
index 27dc3a2..f717825 100644
--- a/docs/zh/latest/architecture-design/global-rule.md
+++ b/docs/zh/latest/architecture-design/global-rule.md
@@ -24,6 +24,8 @@ title: Global rule
 [Plugin](plugin.md) 只能绑定在 [Service](service.md) 或者 [Route](route.md) 
上,如果我们需要一个能作用于所有请求的 [Plugin](plugin.md) 该怎么办呢?
 这时候我们可以使用 `GlobalRule` 来注册一个全局的 [Plugin](plugin.md):
 
+当 `Route` 和 `Service` 都开启同一个插件时,APISIX 只会执行 `Route` 上的插件,`Service` 上的插件被覆盖。但是 
`GlobalRule` 上的插件一定会执行,无论 `Route` 和 `Service` 上是否开启同一个插件。
+
 ```shell
 curl -X PUT \
   https://{apisix_listen_address}/apisix/admin/global_rules/1 \
@@ -44,9 +46,6 @@ curl -X PUT \
 
 如上所注册的 `limit-count` 插件将会作用于所有的请求。
 
-我们可以通过以下接口查看所有的 `GlobalRule`:
-当 `Route` 和 `Service` 都开启同一个插件时,Route 参数的优先级是高于 Service 
的。但是`GlobalRule`优先级高于`Route`和`Service`
-
 ```shell
 curl https://{apisix_listen_address}/apisix/admin/global_rules -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1'
 ```


[apisix] 01/02: Merge branch 'master' of https://github.com/apache/apisix into patch-1

2021-09-26 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch patch-1
in repository https://gitbox.apache.org/repos/asf/apisix.git

commit 5c7b92b2fc63bf4ae7f052f7ac588bf153762d9f
Merge: 4f980f3 912
Author: tzssangglass 
AuthorDate: Mon Sep 27 09:29:20 2021 +0800

Merge branch 'master' of https://github.com/apache/apisix into patch-1

 .asf.yaml  |   30 +
 .github/ISSUE_TEMPLATE/bug.md  |   33 -
 .github/ISSUE_TEMPLATE/bug_report.yml  |   65 +
 .github/ISSUE_TEMPLATE/config.yml  |5 +
 .github/ISSUE_TEMPLATE/improve-docs.md |   15 -
 .github/ISSUE_TEMPLATE/improve_docs.yml|   28 +
 .github/ISSUE_TEMPLATE/request-help.md |   21 -
 .github/ISSUE_TEMPLATE/request_help.yml|   35 +
 .github/actions/action-tmate   |1 +
 .github/workflows/build.yml|8 +-
 .github/workflows/centos7-ci.yml   |   17 +-
 .github/workflows/chaos.yml|   60 +-
 .github/workflows/code-lint.yml|2 +-
 .github/workflows/doc-lint.yml |2 +-
 .github/workflows/fuzzing-ci.yaml  |   11 +-
 .github/workflows/license-checker.yml  |   38 +
 .github/workflows/lint.yml |3 -
 .github/workflows/stale.yml|   43 +
 .gitignore |   20 +-
 .gitmodules|3 +
 t/fuzzing/upstream/nginx.conf => .licenserc.yaml   |   64 +-
 CHANGELOG.md   |  106 ++
 Makefile   |   17 +-
 README.md  |  128 +-
 apisix/admin/consumers.lua |   18 +-
 apisix/admin/global_rules.lua  |   16 +-
 apisix/admin/init.lua  |   10 +-
 apisix/admin/plugin_config.lua |   16 +-
 apisix/admin/plugin_metadata.lua   |8 +-
 apisix/admin/plugins.lua   |   10 +-
 apisix/admin/proto.lua |   54 +-
 apisix/admin/routes.lua|   21 +-
 apisix/admin/services.lua  |   18 +-
 apisix/admin/ssl.lua   |   22 +-
 apisix/admin/stream_routes.lua |   24 +-
 apisix/admin/upstreams.lua |   20 +-
 apisix/admin/utils.lua |   11 +-
 apisix/api_router.lua  |   16 +-
 apisix/balancer.lua|   71 +-
 apisix/balancer/chash.lua  |8 +-
 apisix/balancer/ewma.lua   |6 +-
 apisix/cli/env.lua |   13 +-
 apisix/cli/file.lua|   25 +-
 apisix/cli/ngx_tpl.lua |  129 +-
 apisix/cli/ops.lua |  263 +++-
 apisix/constants.lua   |1 +
 apisix/control/v1.lua  |   82 +-
 apisix/core.lua|2 +-
 apisix/core/config_etcd.lua|   84 +-
 apisix/core/config_util.lua|   89 ++
 apisix/core/ctx.lua|   24 +-
 apisix/core/dns/client.lua |2 +-
 apisix/core/etcd.lua   |4 +-
 apisix/core/ip.lua |   66 +
 apisix/core/lrucache.lua   |   18 +-
 apisix/core/string.lua |   12 +
 apisix/core/utils.lua  |   67 +-
 apisix/core/version.lua|2 +-
 apisix/debug.lua   |   55 +-
 apisix/discovery/consul_kv.lua |   17 +-
 apisix/discovery/dns.lua   |2 +-
 apisix/discovery/nacos.lua |   62 +-
 apisix/{cli/html_page.lua => error_handling.lua}   |   19 +-
 apisix/http/route.lua  |   15 +-
 apisix/http/router/radixtree_host_uri.lua  |   48 +-
 apisix/http/router/radixtree_uri.lua   |   12 +-
 .../http/router/radixtree_uri_with_parameter.lua   |   12 +-
 apisix/init.lua|   90 +-
 apisix/patch.lua   |   43 +
 apisix/plugin.lua  |   80 +-
 apisix/plugin_config.lua   |   11 +-
 apisix/plugins/api-breaker.lua |2 +-
 apisix/plugins/authz-casbin.lua|  135 ++
 apisix/plugins/authz-keycloak.lua  |9 +-
 apisix/plugin

[apisix] branch patch-1 created (now b3bf9fa)

2021-09-26 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a change to branch patch-1
in repository https://gitbox.apache.org/repos/asf/apisix.git.


  at b3bf9fa  resolve code review

This branch includes the following new commits:

 new 5c7b92b  Merge branch 'master' of https://github.com/apache/apisix 
into patch-1
 new b3bf9fa  resolve code review

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[apisix-java-plugin-runner] branch main updated: fix: convert the conf req to an object and put it in the cache (#73)

2021-09-26 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new a5ca9ca  fix: convert the conf req to an object and put it in the 
cache (#73)
a5ca9ca is described below

commit a5ca9ca8045a19694b94c57986ae7d298eff986e
Author: tzssangglass 
AuthorDate: Mon Sep 27 08:48:51 2021 +0800

fix: convert the conf req to an object and put it in the cache (#73)
---
 .../plugin/runner/handler/A6ConfigHandler.java | 25 --
 .../plugin/runner/handler/A6HttpCallHandler.java   |  2 +-
 .../plugin/runner/handler/A6ConfigHandlerTest.java | 25 +-
 .../org/apache/apisix/plugin/runner/A6Conf.java| 22 +++
 .../apache/apisix/plugin/runner/HttpRequest.java   | 12 +++
 5 files changed, 50 insertions(+), 36 deletions(-)

diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6ConfigHandler.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6ConfigHandler.java
index 9590a97..94c07cd 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6ConfigHandler.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6ConfigHandler.java
@@ -31,8 +31,8 @@ import 
org.apache.apisix.plugin.runner.filter.PluginFilterChain;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.nio.ByteBuffer;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -52,17 +52,20 @@ public class A6ConfigHandler implements Handler {
 Req req = ((A6ConfigRequest) request).getReq();
 long token = ((A6ConfigResponse) response).getConfToken();
 PluginFilterChain chain = createFilterChain(req);
-ByteBuffer bb = req.getByteBuffer();
 
-/**
-* to reset vtable_start and vtable_size of req,
-* so that req can be reused after being got from the cache.
-* {@link 
org.apache.apisix.plugin.runner.handler.A6HttpCallHandler#handle 
cache.getIfPresent()}
-* @see  
https://github.com/apache/apisix-java-plugin-runner/issues/63
-* */
-req.__init(bb.getInt(bb.position()) + bb.position(), bb);
-A6Conf config = new A6Conf(req, chain);
-cache.put(token, config);
+/*
+ * to reset vtable_start and vtable_size of req,
+ * so that req can be reused after being got from the cache.
+ * {@link 
org.apache.apisix.plugin.runner.handler.A6HttpCallHandler#handle 
cache.getIfPresent()}
+ * @see  
https://github.com/apache/apisix-java-plugin-runner/issues/63
+ * */
+Map config = new HashMap<>();
+for (int i = 0; i < req.confLength(); i++) {
+TextEntry conf = req.conf(i);
+config.put(conf.name(), conf.value());
+}
+A6Conf a6Conf = new A6Conf(config, chain);
+cache.put(token, a6Conf);
 }
 
 private PluginFilterChain createFilterChain(Req req) {
diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6HttpCallHandler.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6HttpCallHandler.java
index 1b410ec..4f3ead4 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6HttpCallHandler.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6HttpCallHandler.java
@@ -52,7 +52,7 @@ public class A6HttpCallHandler implements Handler {
 return;
 }
 
-req.initCtx(rsp, conf.getReq());
+req.initCtx(rsp, conf.getConfig());
 PluginFilterChain chain = conf.getChain();
 chain.filter(req, rsp);
 }
diff --git 
a/runner-core/src/test/java/org/apache/apisix/plugin/runner/handler/A6ConfigHandlerTest.java
 
b/runner-core/src/test/java/org/apache/apisix/plugin/runner/handler/A6ConfigHandlerTest.java
index bcd9c5b..34792e8 100644
--- 
a/runner-core/src/test/java/org/apache/apisix/plugin/runner/handler/A6ConfigHandlerTest.java
+++ 
b/runner-core/src/test/java/org/apache/apisix/plugin/runner/handler/A6ConfigHandlerTest.java
@@ -100,7 +100,6 @@ class A6ConfigHandlerTest {
 Assertions.assertEquals(config.getChain().getFilters().size(), 1);
 Assertions.assertEquals(config.getChain().getIndex(), 0);
 Assertions.assertEquals(config.get("FooFilter"), "Bar");
-
 }
 
 @Test
@@ -176,4 +175,28 @@ class A6ConfigHandlerTest {
 A6Conf config = cache.getIfPresent(0L);
 Assertions.assertEquals(config.getChain().getFilters().size(), 0);
 }
+
+@Test
+@DisplayName("test fetch conf more times")
+void testAddFilter5() {
+FlatBufferBuilder builder = new FlatBufferBuilder();
+int

[apisix-java-plugin-runner] branch main updated: fix: reset vtable_start and vtable_size of PrepareConf/Req (#66)

2021-09-09 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
 new 62d3a57  fix: reset vtable_start and vtable_size of PrepareConf/Req 
(#66)
62d3a57 is described below

commit 62d3a575754e5035e30e33d469ef52f794791e9d
Author: tzssangglass 
AuthorDate: Fri Sep 10 09:10:30 2021 +0800

fix: reset vtable_start and vtable_size of PrepareConf/Req (#66)
---
 .../apache/apisix/plugin/runner/handler/A6ConfigHandler.java   | 10 ++
 1 file changed, 10 insertions(+)

diff --git 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6ConfigHandler.java
 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6ConfigHandler.java
index c69e4b3..9590a97 100644
--- 
a/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6ConfigHandler.java
+++ 
b/runner-core/src/main/java/org/apache/apisix/plugin/runner/handler/A6ConfigHandler.java
@@ -31,6 +31,7 @@ import 
org.apache.apisix.plugin.runner.filter.PluginFilterChain;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -51,6 +52,15 @@ public class A6ConfigHandler implements Handler {
 Req req = ((A6ConfigRequest) request).getReq();
 long token = ((A6ConfigResponse) response).getConfToken();
 PluginFilterChain chain = createFilterChain(req);
+ByteBuffer bb = req.getByteBuffer();
+
+/**
+* to reset vtable_start and vtable_size of req,
+* so that req can be reused after being got from the cache.
+* {@link 
org.apache.apisix.plugin.runner.handler.A6HttpCallHandler#handle 
cache.getIfPresent()}
+* @see  
https://github.com/apache/apisix-java-plugin-runner/issues/63
+* */
+req.__init(bb.getInt(bb.position()) + bb.position(), bb);
 A6Conf config = new A6Conf(req, chain);
 cache.put(token, config);
 }


[apisix] branch master updated: feat(plugin): add limit quota header switch for limit-count (#4782)

2021-08-09 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 7b69a37  feat(plugin): add limit quota header switch for limit-count 
(#4782)
7b69a37 is described below

commit 7b69a374ac5b31dc0dedc74291fc96f1e7d05a26
Author: okaybase <75366457+okayb...@users.noreply.github.com>
AuthorDate: Tue Aug 10 10:54:34 2021 +0800

feat(plugin): add limit quota header switch for limit-count (#4782)

Co-authored-by: 罗泽轩 
---
 apisix/plugins/limit-count.lua|  9 --
 docs/en/latest/plugins/limit-count.md |  1 +
 docs/zh/latest/plugins/limit-count.md |  1 +
 t/plugin/limit-count-redis2.t | 55 +++
 4 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/apisix/plugins/limit-count.lua b/apisix/plugins/limit-count.lua
index ac0f603..482db82 100644
--- a/apisix/plugins/limit-count.lua
+++ b/apisix/plugins/limit-count.lua
@@ -50,7 +50,8 @@ local schema = {
 enum = {"local", "redis", "redis-cluster"},
 default = "local",
 },
-allow_degradation = {type = "boolean", default = false}
+allow_degradation = {type = "boolean", default = false},
+show_limit_quota_header = {type = "boolean", default = true}
 },
 required = {"count", "time_window"},
 dependencies = {
@@ -184,8 +185,10 @@ function _M.access(conf, ctx)
 return 500, {error_msg = "failed to limit count: " .. err}
 end
 
-core.response.set_header("X-RateLimit-Limit", conf.count,
- "X-RateLimit-Remaining", remaining)
+if conf.show_limit_quota_header then
+core.response.set_header("X-RateLimit-Limit", conf.count,
+"X-RateLimit-Remaining", remaining)
+end
 end
 
 
diff --git a/docs/en/latest/plugins/limit-count.md 
b/docs/en/latest/plugins/limit-count.md
index 9b921be..8f5258c 100644
--- a/docs/en/latest/plugins/limit-count.md
+++ b/docs/en/latest/plugins/limit-count.md
@@ -43,6 +43,7 @@ Limit request rate by a fixed number of requests in a given 
time window.
 | rejected_code   | integer | optional| 
503   | [200,...,599]   
| The HTTP status code returned when 
the request exceeds the threshold is rejected, default 503. 


|
 | policy  | string  | optional| 
"local"   | ["local", "redis", "redis-cluster"] 
| The rate-limiting policies to use for 
retrieving and incrementing the limits. Available values are `local`(the 
counters will be stored locally in-memory on the node), `redis`(counters are 
stored on a Redis server and will be shared across the nodes, usually use it to 
do the global speed limit) [...]
 | allow_degradation  | boolean  | optional 
   | false   |  
   | Whether to enable plugin degradation when the limit-count function 
is temporarily unavailable(e.g. redis timeout). Allow requests to continue when 
the value is set to true, default false. |
+| show_limit_quota_header  | boolean  | optional   
 | true   | 
| Whether show `X-RateLimit-Limit` and `X-RateLimit-Remaining` 
(which mean the total number of requests and the remaining number of requests 
that can be sent) in the response header, default true. |
 | redis_host  | string  | required for `redis`|
   |
 | When using the `redis` policy, this 
property specifies the address of the Redis server. 


   |
 | redis_port  | integer | optional| 
6379  | [1,..

[apisix] branch master updated: docs: improve redis password/timeout desc (#4783)

2021-08-09 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 2238b54  docs: improve redis password/timeout desc (#4783)
2238b54 is described below

commit 2238b547cb64515a90eeb6232dfd9ee5b979681a
Author: okaybase <75366457+okayb...@users.noreply.github.com>
AuthorDate: Tue Aug 10 00:55:27 2021 +0800

docs: improve redis password/timeout desc (#4783)
---
 docs/en/latest/plugins/limit-count.md | 4 ++--
 docs/zh/latest/plugins/limit-count.md | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/en/latest/plugins/limit-count.md 
b/docs/en/latest/plugins/limit-count.md
index b178ac5..9b921be 100644
--- a/docs/en/latest/plugins/limit-count.md
+++ b/docs/en/latest/plugins/limit-count.md
@@ -45,9 +45,9 @@ Limit request rate by a fixed number of requests in a given 
time window.
 | allow_degradation  | boolean  | optional 
   | false   |  
   | Whether to enable plugin degradation when the limit-count function 
is temporarily unavailable(e.g. redis timeout). Allow requests to continue when 
the value is set to true, default false. |
 | redis_host  | string  | required for `redis`|
   |
 | When using the `redis` policy, this 
property specifies the address of the Redis server. 


   |
 | redis_port  | integer | optional| 
6379  | [1,...] 
| When using the `redis` policy, this 
property specifies the port of the Redis server.


   |
-| redis_password  | string  | optional|
   |
 | When using the `redis` policy, this 
property specifies the password of the Redis server.


   |
+| redis_password  | string  | optional|
   |
 | When using the `redis`  or 
`redis-cluster` policy, this property specifies the password of the Redis 
server. 

  [...]
 | redis_database  | integer | optional| 0  
   | redis_database >= 0
 | When using the `redis` policy, this 
property specifies the database you selected of the Redis server, and only for 
non Redis cluster mode (single instance mode or Redis public cloud service that 
provides single entry). 
  |
-| redis_timeout   | integer | optional| 
1000  | [1,...] 
| When using the `redis` policy, this 
property specifies the timeout in milliseconds of any command submitted to the 
Redis server.   

|
+| redis_timeout   | integer | optional| 
1000  | [1,...] 
| When using the `redis`  or 
`redis-cluster` policy, this property specifies the timeout in milliseconds of 
any command submitted to the Redis server.  

 [...]
 | redis_cluster_nodes | array   | required when policy is `redi

[apisix] branch master updated: fix(admin): inject updatetime when the requst is PATCH with sub path (#4765)

2021-08-06 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 7a1287a  fix(admin): inject updatetime when the requst is PATCH with 
sub path (#4765)
7a1287a is described below

commit 7a1287a62aebb49c76c439be52835da940cb0ce0
Author: 罗泽轩 
AuthorDate: Fri Aug 6 21:47:09 2021 +0800

fix(admin): inject updatetime when the requst is PATCH with sub path (#4765)

* fix(admin): inject updatetime when the requst is PATCH with sub path

Fix #4763

Signed-off-by: spacewander 

* fix typo error

Signed-off-by: spacewander 
---
 apisix/admin/global_rules.lua  |  4 ++--
 apisix/admin/plugin_config.lua |  4 ++--
 apisix/admin/routes.lua|  4 ++--
 apisix/admin/services.lua  |  4 ++--
 apisix/admin/ssl.lua   |  5 ++---
 apisix/admin/upstreams.lua |  4 ++--
 apisix/admin/utils.lua | 11 +--
 t/admin/upstream4.t| 43 ++
 8 files changed, 64 insertions(+), 15 deletions(-)

diff --git a/apisix/admin/global_rules.lua b/apisix/admin/global_rules.lua
index 658ec57..caccc91 100644
--- a/apisix/admin/global_rules.lua
+++ b/apisix/admin/global_rules.lua
@@ -150,14 +150,14 @@ function _M.patch(id, conf, sub_path)
 if code then
 return code, err
 end
+utils.inject_timestamp(node_value, nil, true)
 else
 node_value = core.table.merge(node_value, conf);
+utils.inject_timestamp(node_value, nil, conf)
 end
 
 core.log.info("new conf: ", core.json.delay_encode(node_value, true))
 
-utils.inject_timestamp(node_value, nil, conf)
-
 local ok, err = check_conf(id, node_value, true)
 if not ok then
 return 400, err
diff --git a/apisix/admin/plugin_config.lua b/apisix/admin/plugin_config.lua
index c7f7f44..74302df 100644
--- a/apisix/admin/plugin_config.lua
+++ b/apisix/admin/plugin_config.lua
@@ -148,14 +148,14 @@ function _M.patch(id, conf, sub_path)
 if code then
 return code, err
 end
+utils.inject_timestamp(node_value, nil, true)
 else
 node_value = core.table.merge(node_value, conf);
+utils.inject_timestamp(node_value, nil, conf)
 end
 
 core.log.info("new conf: ", core.json.delay_encode(node_value, true))
 
-utils.inject_timestamp(node_value, nil, conf)
-
 local ok, err = check_conf(id, node_value, true)
 if not ok then
 return 400, err
diff --git a/apisix/admin/routes.lua b/apisix/admin/routes.lua
index 8be4740..bed0524 100644
--- a/apisix/admin/routes.lua
+++ b/apisix/admin/routes.lua
@@ -283,12 +283,12 @@ function _M.patch(id, conf, sub_path, args)
 if code then
 return code, err
 end
+utils.inject_timestamp(node_value, nil, true)
 else
 node_value = core.table.merge(node_value, conf);
+utils.inject_timestamp(node_value, nil, conf)
 end
 
-utils.inject_timestamp(node_value, nil, conf)
-
 core.log.info("new conf: ", core.json.delay_encode(node_value, true))
 
 local id, err = check_conf(id, node_value, true)
diff --git a/apisix/admin/services.lua b/apisix/admin/services.lua
index e57b551..faef65a 100644
--- a/apisix/admin/services.lua
+++ b/apisix/admin/services.lua
@@ -236,12 +236,12 @@ function _M.patch(id, conf, sub_path)
 if code then
 return code, err
 end
+utils.inject_timestamp(node_value, nil, true)
 else
 node_value = core.table.merge(node_value, conf);
+utils.inject_timestamp(node_value, nil, conf)
 end
 
-utils.inject_timestamp(node_value, nil, conf)
-
 core.log.info("new value ", core.json.delay_encode(node_value, true))
 
 local id, err = check_conf(id, node_value, true)
diff --git a/apisix/admin/ssl.lua b/apisix/admin/ssl.lua
index 5fd3235..fc16e1c 100644
--- a/apisix/admin/ssl.lua
+++ b/apisix/admin/ssl.lua
@@ -203,6 +203,7 @@ function _M.patch(id, conf, sub_path)
 if code then
 return code, err
 end
+utils.inject_timestamp(node_value, nil, true)
 else
 if conf.key then
 conf.key = apisix_ssl.aes_encrypt_pkey(conf.key)
@@ -215,11 +216,9 @@ function _M.patch(id, conf, sub_path)
 end
 
 node_value = core.table.merge(node_value, conf);
+utils.inject_timestamp(node_value, nil, conf)
 end
 
-
-utils.inject_timestamp(node_value, nil, conf)
-
 core.log.info("new ssl conf: ", core.json.delay_encode(node_value, true))
 
 local id, err = check_conf(id, node_value, true)
diff --git a/apisix/admin/upstreams.lua b/apisix/admin/upstreams.lua
index 3d93c75..8180cdb 100644
--- a/apisix/admin/upstreams.lua
+++ b/apisix/admin/upstreams.lua
@@ -204,12 +204,12 @@

[apisix] branch master updated: feat(cors): validate allow_origins (#4757)

2021-08-06 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 391a2d3  feat(cors): validate allow_origins (#4757)
391a2d3 is described below

commit 391a2d3e40578b15127c4b2f5f26af7156721a2f
Author: 罗泽轩 
AuthorDate: Fri Aug 6 18:05:35 2021 +0800

feat(cors): validate allow_origins (#4757)

Fix #4717

Signed-off-by: spacewander 
---
 apisix/plugins/cors.lua|  1 +
 t/config-center-yaml/global-rule.t |  2 +-
 t/plugin/cors.t|  4 +-
 t/plugin/cors2.t   | 91 ++
 4 files changed, 95 insertions(+), 3 deletions(-)

diff --git a/apisix/plugins/cors.lua b/apisix/plugins/cors.lua
index 4b0b7c4..173c176 100644
--- a/apisix/plugins/cors.lua
+++ b/apisix/plugins/cors.lua
@@ -37,6 +37,7 @@ local schema = {
 "'**' to allow forcefully(it will bring some security risks, 
be carefully)," ..
 "multiple origin use ',' to split. default: *.",
 type = "string",
+pattern = [[^(\*|\*\*|null|\w+://[^,]+(,\w+://[^,]+)*)$]],
 default = "*"
 },
 allow_methods = {
diff --git a/t/config-center-yaml/global-rule.t 
b/t/config-center-yaml/global-rule.t
index 67bc24a..2621a69 100644
--- a/t/config-center-yaml/global-rule.t
+++ b/t/config-center-yaml/global-rule.t
@@ -122,7 +122,7 @@ global_rules:
 id: 1
 plugins:
 cors:
-allow_origins: "a.com,b.com"
+allow_origins: "http://a.com,http://b.com";
 #END
 --- request
 GET /apisix/prometheus/metrics
diff --git a/t/plugin/cors.t b/t/plugin/cors.t
index 8c561e7..eef790d 100644
--- a/t/plugin/cors.t
+++ b/t/plugin/cors.t
@@ -30,7 +30,7 @@ __DATA__
 content_by_lua_block {
 local plugin = require("apisix.plugins.cors")
 local ok, err = plugin.check_schema({
-allow_origins = '',
+allow_origins = 'http://test.com',
 allow_methods = '',
 allow_headers = '',
 expose_headers = '',
@@ -59,7 +59,7 @@ done
 content_by_lua_block {
 local plugin = require("apisix.plugins.cors")
 local ok, err = plugin.check_schema({
-allow_origins = '',
+allow_origins = 'http://test.com',
 allow_methods = '',
 allow_headers = '',
 expose_headers = '',
diff --git a/t/plugin/cors2.t b/t/plugin/cors2.t
new file mode 100644
index 000..67f6d6b
--- /dev/null
+++ b/t/plugin/cors2.t
@@ -0,0 +1,91 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+use t::APISIX 'no_plan';
+
+repeat_each(1);
+no_long_string();
+no_root_location();
+no_shuffle();
+log_level("info");
+
+add_block_preprocessor(sub {
+my ($block) = @_;
+
+if (!$block->request) {
+$block->set_value("request", "GET /t");
+}
+
+if (!$block->no_error_log && !$block->error_log) {
+$block->set_value("no_error_log", "[error]\n[alert]");
+}
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: validate allow_origins
+--- config
+location /t {
+content_by_lua_block {
+local plugin = require("apisix.plugins.cors")
+local function validate(val)
+local conf = {}
+conf.allow_origins = val
+return plugin.check_schema(conf)
+end
+
+local good = {
+"*",
+"**",
+"null",
+"http://y.com.uk";,
+"https://x.com";,
+"https://x.com,http://y.com.uk";,
+&qu

[apisix] branch master updated: fix(error-log-logger): avoid sending stale error log (#4690)

2021-08-01 Thread tzssangglass
This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 9f01ef8  fix(error-log-logger): avoid sending stale error log (#4690)
9f01ef8 is described below

commit 9f01ef8f2ca753557289ac9dc91f5212432fae73
Author: 罗泽轩 
AuthorDate: Mon Aug 2 10:16:11 2021 +0800

fix(error-log-logger): avoid sending stale error log (#4690)
---
 apisix/plugins/error-log-logger.lua | 14 -
 t/plugin/error-log-logger.t | 39 -
 2 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/apisix/plugins/error-log-logger.lua 
b/apisix/plugins/error-log-logger.lua
index 70d5b1c..d7b04b6 100644
--- a/apisix/plugins/error-log-logger.lua
+++ b/apisix/plugins/error-log-logger.lua
@@ -25,7 +25,6 @@ local table = core.table
 local schema_def = core.schema
 local ngx = ngx
 local tcp = ngx.socket.tcp
-local string = string
 local tostring = tostring
 local ipairs  = ipairs
 local lrucache = core.lrucache.new({
@@ -122,12 +121,12 @@ end
 
 
 local function update_filter(value)
-local level = log_level[string.upper(value.level)]
+local level = log_level[value.level]
 local status, err = errlog.set_filter_level(level)
 if not status then
 return nil, "failed to set filter level by ngx.errlog, the error is :" 
.. err
 else
-core.log.debug("set the filter_level to ", config.level)
+core.log.notice("set the filter_level to ", value.level)
 end
 
 return value
@@ -149,12 +148,17 @@ local function process()
 
 end
 
+local err_level = log_level[metadata.value.level]
 local entries = {}
 local logs = errlog.get_logs(9)
 while ( logs and #logs>0 ) do
 for i = 1, #logs, 3 do
-table.insert(entries, logs[i + 2])
-table.insert(entries, "\n")
+-- There will be some stale error logs after the filter level 
changed.
+-- We should avoid reporting them.
+if logs[i] <= err_level then
+table.insert(entries, logs[i + 2])
+table.insert(entries, "\n")
+end
 end
 logs = errlog.get_logs(9)
 end
diff --git a/t/plugin/error-log-logger.t b/t/plugin/error-log-logger.t
index 0fc9f2c..2d2792f 100644
--- a/t/plugin/error-log-logger.t
+++ b/t/plugin/error-log-logger.t
@@ -327,7 +327,44 @@ qr/please set the correct plugin_metadata for 
error-log-logger/
 
 
 
-=== TEST 10: delete the route
+=== TEST 10: avoid sending stale error log
+--- yaml_config
+apisix:
+enable_admin: true
+admin_key: null
+plugins:
+  - error-log-logger
+--- config
+location /tg {
+content_by_lua_block {
+local core = require("apisix.core")
+local t = require("lib.test_admin").test
+core.log.warn("this is a warning message for test.")
+local code, body = 
t('/apisix/admin/plugin_metadata/error-log-logger',
+ngx.HTTP_PUT,
+[[{
+"host": "127.0.0.1",
+"port": 1999,
+"level": "ERROR",
+"inactive_timeout": 1
+}]]
+)
+ngx.sleep(2)
+core.log.error("this is an error message for test.")
+}
+}
+--- request
+GET /tg
+--- response_body
+--- no_error_log eval
+qr/\[Server\] receive data:.*this is a warning message for test./
+--- error_log eval
+qr/\[Server\] receive data:.*this is an error message for test./
+--- wait: 5
+
+
+
+=== TEST 11: delete the route
 --- yaml_config
 apisix:
 enable_admin: true