Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix incorrect shebang in rpm package for 2.10.x #125

Merged
merged 1 commit into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions .github/workflows/package-apisix-rpm-el7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- name: packaging APISIX(-remote) with remote code
run: |
make package type=rpm app=apisix version=2.7 checkout=release/2.7 image_base=centos image_tag=7 artifact=apisix-remote
make package type=rpm app=apisix version=2.10.1 checkout=2.10.1 image_base=centos image_tag=7 artifact=apisix-remote
make package type=rpm app=apisix version=master checkout=master image_base=centos image_tag=7 artifact=apisix-remote

- name: packaging APISIX(-local) with local code
Expand All @@ -56,24 +57,42 @@ jobs:
docker exec centos7Instance bash -c "rpm --import https://repos.apiseven.com/KEYS"
docker exec centos7Instance bash -c "yum -y install https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm"

- name: install APISIX(-remote) by rpm in container
- name: install APISIX(-remote) master by rpm in container
run: |
docker exec centos7Instance bash -c "yum -y localinstall /output/apisix-remote-master-0.el7.x86_64.rpm"
docker exec centos7Instance bash -c "apisix start"

- name: check and ensure APISIX(-remote) is installed
- name: check and ensure APISIX(-remote) master is installed
run: |
code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/apisix/admin/routes -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1')
if [ ! $code -eq 200 ]; then
echo "failed: failed to install Apache APISIX by rpm"
exit 1
fi

- name: stop and uninstall APISIX(-remote)
- name: stop and uninstall APISIX(-remote) master
run: |
docker exec centos7Instance bash -c "pkill -f nginx"
docker exec centos7Instance bash -c "yum -y erase apisix-remote-master"

- name: install APISIX(-remote) 2.10.1 by rpm in container
run: |
docker exec centos7Instance bash -c "yum -y localinstall /output/apisix-remote-2.10.1-0.el7.x86_64.rpm"
docker exec centos7Instance bash -c "apisix start"

- name: check and ensure APISIX(-remote) 2.10.1 is installed
run: |
code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/apisix/admin/routes -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1')
if [ ! $code -eq 200 ]; then
echo "failed: failed to install Apache APISIX by rpm"
exit 1
fi

- name: stop and uninstall APISIX(-remote) 2.10.1
run: |
docker exec centos7Instance bash -c "pkill -f nginx"
docker exec centos7Instance bash -c "yum -y erase apisix-remote-2.10.1"

- name: install APISIX(-local) by rpm in container
run: |
docker exec centos7Instance bash -c "yum -y localinstall /output/apisix-local-master-0.el7.x86_64.rpm"
Expand Down
17 changes: 15 additions & 2 deletions utils/install-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ install_etcd() {
tar -zxvf etcd-"${RUNNING_ETCD_VERSION}"-linux-amd64.tar.gz
}

version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }

is_newer_version() {
if [ "${checkout_v}" = "master" -o "${checkout_v:0:7}" = "release" ];then
return 0
fi
if [ "${checkout_v:0:1}" = "v" ];then
version_gt "${checkout_v:1}" "2.2"
else
version_gt "${checkout_v}" "2.2"
fi
}

install_apisix() {
# show awk version
awk --version
Expand All @@ -94,15 +107,15 @@ install_apisix() {
cp /tmp/build/output/apisix/usr/local/apisix/deps/lib64/luarocks/rocks-5.1/apisix/master-${iteration}/bin/apisix /tmp/build/output/apisix/usr/bin/ || true
cp /tmp/build/output/apisix/usr/local/apisix/deps/lib/luarocks/rocks-5.1/apisix/master-${iteration}/bin/apisix /tmp/build/output/apisix/usr/bin/ || true
# modify the apisix entry shell to be compatible with version 2.2 and 2.3
if [ "${checkout_v}" = "master" ] || [ "${checkout_v:0:1}" != "v" -a "${checkout_v}" \> "2.2" ] || [ "${checkout_v:0:1}" = "v" -a "${checkout_v:1}" \> "2.2" ]; then
if is_newer_version "${checkout_v}"; then
echo 'use shell '
else
bin='#! /usr/local/openresty/luajit/bin/luajit\npackage.path = "/usr/local/apisix/?.lua;" .. package.path'
sed -i "1s@.*@$bin@" /tmp/build/output/apisix/usr/bin/apisix
fi
cp -r /usr/local/apisix/* /tmp/build/output/apisix/usr/local/apisix/
mv /tmp/build/output/apisix/usr/local/apisix/deps/share/lua/5.1/apisix /tmp/build/output/apisix/usr/local/apisix/
if [ "${checkout_v}" = "master" ] || [ "${checkout_v:0:1}" != "v" -a "${checkout_v}" \> "2.2" ] || [ "${checkout_v:0:1}" = "v" -a "${checkout_v:1}" \> "2.2" ]; then
if is_newer_version "${checkout_v}"; then
bin='package.path = "/usr/local/apisix/?.lua;" .. package.path'
sed -i "1s@.*@$bin@" /tmp/build/output/apisix/usr/local/apisix/apisix/cli/apisix.lua
else
Expand Down