This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 7440192  bugfix(CI): avoid to install APISIX to `deps` folder, that is 
a bug for older luarocks (#1471)
7440192 is described below

commit 7440192f8fdf679dadc3e816767762e6047d0893
Author: YuanSheng Wang <membp...@gmail.com>
AuthorDate: Mon Apr 20 09:09:14 2020 +0800

    bugfix(CI): avoid to install APISIX to `deps` folder, that is a bug for 
older luarocks (#1471)
    
    If the Luarocks version is lower than "v2.4.3", it does not support the 
"--only-deps" parameter. Even if we set the "--only-deps" parameter, no error 
message will be given during runtime.
    
    We only wanted to install the dependencies in the deps directory, but the 
APISIX was also installed so that the test case might load the wrong version of 
the source code.
---
 .travis.yml                                     |  2 --
 .travis/linux_apisix_current_luarocks_runner.sh | 18 ++++++++++------
 .travis/linux_apisix_master_luarocks_runner.sh  | 20 +++++++++++-------
 .travis/linux_openresty_runner.sh               | 28 +++++++++++++++++++------
 .travis/linux_tengine_runner.sh                 | 18 ++++++++++++++--
 Makefile                                        |  1 +
 apisix/plugins/proxy-rewrite.lua                |  3 +++
 rockspec/apisix-master-0.rockspec               |  1 +
 t/APISIX.pm                                     |  8 +++----
 t/plugin/proxy-rewrite.t                        |  2 ++
 utils/install-apisix.sh                         |  4 ++--
 11 files changed, 76 insertions(+), 29 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 2ed45cd..d33d27c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -38,8 +38,6 @@ addons:
       - libssl-dev
       - perl
       - etcd
-      - luarocks
-      - lua-check
   homebrew:
     update: true
 
diff --git a/.travis/linux_apisix_current_luarocks_runner.sh 
b/.travis/linux_apisix_current_luarocks_runner.sh
index 8a4e672..b67e115 100755
--- a/.travis/linux_apisix_current_luarocks_runner.sh
+++ b/.travis/linux_apisix_current_luarocks_runner.sh
@@ -30,7 +30,16 @@ do_install() {
     sudo add-apt-repository -y ppa:longsleep/golang-backports
 
     sudo apt-get update
-    sudo apt-get install openresty-debug
+    sudo apt-get install openresty-debug lua5.1 liblua5.1-0-dev
+
+    wget https://github.com/luarocks/luarocks/archive/v2.4.4.tar.gz
+    tar -xf v2.4.4.tar.gz
+    cd luarocks-2.4.4
+    ./configure --prefix=/usr > build.log 2>&1 || (cat build.log && exit 1)
+    make build > build.log 2>&1 || (cat build.log && exit 1)
+    sudo make install > build.log 2>&1 || (cat build.log && exit 1)
+    cd ..
+    rm -rf luarocks-2.4.4
 }
 
 script() {
@@ -42,8 +51,8 @@ script() {
     sudo rm -rf /usr/local/apisix
 
     # install APISIX with local version
-    sudo luarocks install rockspec/apisix-master-0.rockspec --only-deps
-    sudo luarocks make rockspec/apisix-master-0.rockspec
+    sudo luarocks install rockspec/apisix-master-0.rockspec --only-deps  > 
build.log 2>&1 || (cat build.log && exit 1)
+    sudo luarocks make rockspec/apisix-master-0.rockspec > build.log 2>&1 || 
(cat build.log && exit 1)
 
     # show install file
     luarocks show apisix
@@ -62,9 +71,6 @@ script() {
         cat /usr/local/apisix/logs/error.log
         exit 1
     fi
-
-    sudo luarocks purge --tree=/usr/local
-    sudo rm -rf /usr/local/apisix
 }
 
 case_opt=$1
diff --git a/.travis/linux_apisix_master_luarocks_runner.sh 
b/.travis/linux_apisix_master_luarocks_runner.sh
index dc4966c..2c76087 100755
--- a/.travis/linux_apisix_master_luarocks_runner.sh
+++ b/.travis/linux_apisix_master_luarocks_runner.sh
@@ -30,7 +30,16 @@ do_install() {
     sudo add-apt-repository -y ppa:longsleep/golang-backports
 
     sudo apt-get update
-    sudo apt-get install openresty-debug
+    sudo apt-get install openresty-debug lua5.1 liblua5.1-0-dev
+
+    wget https://github.com/luarocks/luarocks/archive/v2.4.4.tar.gz
+    tar -xf v2.4.4.tar.gz
+    cd luarocks-2.4.4
+    ./configure --prefix=/usr > build.log 2>&1 || (cat build.log && exit 1)
+    make build > build.log 2>&1 || (cat build.log && exit 1)
+    sudo make install > build.log 2>&1 || (cat build.log && exit 1)
+    cd ..
+    rm -rf luarocks-2.4.4
 }
 
 script() {
@@ -43,17 +52,17 @@ script() {
 
     # install APISIX by shell
     sudo mkdir -p /usr/local/apisix/deps
-    sudo PATH=$PATH ./utils/install-apisix.sh install
+    sudo PATH=$PATH ./utils/install-apisix.sh install > build.log 2>&1 || (cat 
build.log && exit 1)
 
     sudo PATH=$PATH apisix help
     sudo PATH=$PATH apisix init
     sudo PATH=$PATH apisix start
     sudo PATH=$PATH apisix stop
 
-    sudo PATH=$PATH ./utils/install-apisix.sh remove
+    sudo PATH=$PATH ./utils/install-apisix.sh remove > build.log 2>&1 || (cat 
build.log && exit 1)
 
     # install APISIX by luarocks
-    sudo luarocks install rockspec/apisix-master-0.rockspec
+    sudo luarocks install rockspec/apisix-master-0.rockspec > build.log 2>&1 
|| (cat build.log && exit 1)
 
     # show install files
     luarocks show apisix
@@ -72,9 +81,6 @@ script() {
         cat /usr/local/apisix/logs/error.log
         exit 1
     fi
-
-    sudo luarocks remove rockspec/apisix-master-0.rockspec
-    sudo luarocks purge --tree=/usr/local
 }
 
 case_opt=$1
diff --git a/.travis/linux_openresty_runner.sh 
b/.travis/linux_openresty_runner.sh
index f941f9b..a30f530 100755
--- a/.travis/linux_openresty_runner.sh
+++ b/.travis/linux_openresty_runner.sh
@@ -23,8 +23,10 @@ export_or_prefix() {
 }
 
 create_lua_deps() {
-    sudo luarocks make --lua-dir=${OPENRESTY_PREFIX}/luajit 
rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local
     echo "Create lua deps cache"
+
+    make deps
+
     sudo rm -rf build-cache/deps
     sudo cp -r deps build-cache/
     sudo cp rockspec/apisix-master-0.rockspec build-cache/
@@ -45,6 +47,8 @@ before_install() {
 }
 
 do_install() {
+    export_or_prefix
+
     wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
     sudo apt-get -y update --fix-missing
     sudo apt-get -y install software-properties-common
@@ -52,13 +56,21 @@ do_install() {
     sudo add-apt-repository -y ppa:longsleep/golang-backports
 
     sudo apt-get update
+    sudo apt-get install openresty-debug lua5.1 liblua5.1-0-dev
 
-    sudo apt-get install openresty-debug
-    sudo luarocks install --lua-dir=${OPENRESTY_PREFIX}/luajit luacov-coveralls
+    wget https://github.com/luarocks/luarocks/archive/v2.4.4.tar.gz
+    tar -xf v2.4.4.tar.gz
+    cd luarocks-2.4.4
+    ./configure --prefix=/usr > build.log 2>&1 || (cat build.log && exit 1)
+    make build > build.log 2>&1 || (cat build.log && exit 1)
+    sudo make install > build.log 2>&1 || (cat build.log && exit 1)
+    cd ..
+    rm -rf luarocks-2.4.4
 
-    export GO111MOUDULE=on
+    sudo luarocks install luacov-coveralls --tree=deps --local > build.log 
2>&1 || (cat build.log && exit 1)
+    sudo luarocks install luacheck > build.log 2>&1 || (cat build.log && exit 
1)
 
-    export_or_prefix
+    export GO111MOUDULE=on
 
     if [ ! -f "build-cache/apisix-master-0.rockspec" ]; then
         create_lua_deps
@@ -74,6 +86,9 @@ do_install() {
         fi
     fi
 
+    # sudo apt-get install tree -y
+    # tree deps
+
     git clone https://github.com/iresty/test-nginx.git test-nginx
     make utils
 
@@ -116,8 +131,9 @@ script() {
     ./bin/apisix init
     ./bin/apisix init_etcd
     ./bin/apisix start
-    mkdir -p logs
+
     sleep 1
+    cat logs/error.log
 
     sudo sh ./t/grpc-proxy-test.sh
     sleep 1
diff --git a/.travis/linux_tengine_runner.sh b/.travis/linux_tengine_runner.sh
index 13d28d8..220493e 100755
--- a/.travis/linux_tengine_runner.sh
+++ b/.travis/linux_tengine_runner.sh
@@ -23,8 +23,11 @@ export_or_prefix() {
 }
 
 create_lua_deps() {
-    sudo luarocks make --lua-dir=${OPENRESTY_PREFIX}/luajit 
rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local
     echo "Create lua deps cache"
+
+    rm -rf deps
+    make deps
+
     sudo rm -rf build-cache/deps
     sudo cp -r deps build-cache/
     sudo cp rockspec/apisix-master-0.rockspec build-cache/
@@ -212,10 +215,18 @@ do_install() {
     sudo add-apt-repository -y ppa:longsleep/golang-backports
 
     sudo apt-get update
+    sudo apt-get install lua5.1 liblua5.1-0-dev
 
     tengine_install
 
-    sudo luarocks install --lua-dir=${OPENRESTY_PREFIX}/luajit luacov-coveralls
+    wget https://github.com/luarocks/luarocks/archive/v2.4.4.tar.gz
+    tar -xf v2.4.4.tar.gz
+    cd luarocks-2.4.4
+    ./configure --prefix=/usr > build.log 2>&1 || (cat build.log && exit 1)
+    make build > build.log 2>&1 || (cat build.log && exit 1)
+    sudo make install > build.log 2>&1 || (cat build.log && exit 1)
+    cd ..
+    rm -rf luarocks-2.4.4
 
     export GO111MOUDULE=on
 
@@ -233,6 +244,9 @@ do_install() {
         fi
     fi
 
+    luarocks install luacov-coveralls --tree=deps --local > build.log 2>&1 || 
(cat build.log && exit 1)
+    sudo luarocks install luacheck > build.log 2>&1 || (cat build.log && exit 
1)
+
     git clone https://github.com/iresty/test-nginx.git test-nginx
     make utils
 
diff --git a/Makefile b/Makefile
index 7fe019d..1ecc307 100644
--- a/Makefile
+++ b/Makefile
@@ -111,6 +111,7 @@ reload: default
 ### install:          Install the apisix
 .PHONY: install
 install:
+       $(INSTALL) -d /usr/local/apisix/
        $(INSTALL) -d /usr/local/apisix/logs/
        $(INSTALL) -d /usr/local/apisix/conf/cert
        $(INSTALL) conf/mime.types /usr/local/apisix/conf/mime.types
diff --git a/apisix/plugins/proxy-rewrite.lua b/apisix/plugins/proxy-rewrite.lua
index 5fc4906..e1ee903 100644
--- a/apisix/plugins/proxy-rewrite.lua
+++ b/apisix/plugins/proxy-rewrite.lua
@@ -97,6 +97,9 @@ function _M.check_schema(conf)
                 if #field == 0 then
                     return false, 'invalid field length in header'
                 end
+
+                core.log.info("header field: ", field)
+
                 if not core.utils.validate_header_field(field) then
                     return false, 'invalid field character in header'
                 end
diff --git a/rockspec/apisix-master-0.rockspec 
b/rockspec/apisix-master-0.rockspec
index d9da70e..3c4f344 100644
--- a/rockspec/apisix-master-0.rockspec
+++ b/rockspec/apisix-master-0.rockspec
@@ -14,6 +14,7 @@
 -- See the License for the specific language governing permissions and
 -- limitations under the License.
 --
+
 package = "apisix"
 version = "master-0"
 supported_platforms = {"linux", "macosx"}
diff --git a/t/APISIX.pm b/t/APISIX.pm
index fcdcc25..ca043ed 100644
--- a/t/APISIX.pm
+++ b/t/APISIX.pm
@@ -108,8 +108,8 @@ _EOC_
 
     my $stream_enable = $block->stream_enable;
     my $stream_config = $block->stream_config // <<_EOC_;
-    lua_package_path 
"$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/apisix/?.lua;$apisix_home/t/?.lua;./?.lua;./?/init.lua;;";
-    lua_package_cpath 
"$apisix_home/deps/lib/lua/5.1/?.so;$apisix_home/deps/lib64/lua/5.1/?.so;./?.so;;";
+    lua_package_path 
"./?.lua;./?/init.lua;$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/apisix/?.lua;$apisix_home/t/?.lua;;";
+    lua_package_cpath 
"./?.so;$apisix_home/deps/lib/lua/5.1/?.so;$apisix_home/deps/lib64/lua/5.1/?.so;;";
 
     lua_socket_log_errors off;
 
@@ -187,8 +187,8 @@ _EOC_
 
     my $http_config = $block->http_config // '';
     $http_config .= <<_EOC_;
-    lua_package_path 
"$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/apisix/?.lua;$apisix_home/t/?.lua;./?.lua;./?/init.lua;;";
-    lua_package_cpath 
"$apisix_home/deps/lib/lua/5.1/?.so;$apisix_home/deps/lib64/lua/5.1/?.so;./?.so;;";
+    lua_package_path 
"./?.lua;./?/init.lua;$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/apisix/?.lua;$apisix_home/t/?.lua;;";
+    lua_package_cpath 
"./?.so;$apisix_home/deps/lib/lua/5.1/?.so;$apisix_home/deps/lib64/lua/5.1/?.so;;";
 
     lua_shared_dict plugin-limit-req     10m;
     lua_shared_dict plugin-limit-count   10m;
diff --git a/t/plugin/proxy-rewrite.t b/t/plugin/proxy-rewrite.t
index a5752e0..cb6f2e6 100644
--- a/t/plugin/proxy-rewrite.t
+++ b/t/plugin/proxy-rewrite.t
@@ -957,6 +957,8 @@ GET /t
 qr/invalid field character/
 --- no_error_log
 [error]
+--- error_log
+header field: X-Api:Version
 
 
 
diff --git a/utils/install-apisix.sh b/utils/install-apisix.sh
index 5fc9e99..1363682 100755
--- a/utils/install-apisix.sh
+++ b/utils/install-apisix.sh
@@ -55,8 +55,8 @@ do_install() {
 
 
 do_remove() {
-    sudo rm -f /usr/local/bin/apisix
-    luarocks purge /usr/local/apisix/deps --tree=/usr/local/apisix/deps
+    sudo rm -f /usr/bin/apisix
+    sudo luarocks purge /usr/local/apisix/deps --tree=/usr/local/apisix/deps
 }
 
 

Reply via email to