|
| 1 | +name: package apisix rpm for el8 |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + tags: |
| 7 | + - "v*" |
| 8 | + paths-ignore: |
| 9 | + - '*.md' |
| 10 | + pull_request: |
| 11 | + branches: [ master ] |
| 12 | + paths-ignore: |
| 13 | + - '*.md' |
| 14 | + schedule: |
| 15 | + - cron: '0 0 * * *' |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + timeout-minutes: 60 |
| 21 | + services: |
| 22 | + etcd: |
| 23 | + image: bitnami/etcd:3.4.0 |
| 24 | + ports: |
| 25 | + - 2379:2379 |
| 26 | + - 2380:2380 |
| 27 | + env: |
| 28 | + ALLOW_NONE_AUTHENTICATION: yes |
| 29 | + ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379 |
| 30 | + |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v2 |
| 33 | + |
| 34 | + - name: install dependencies |
| 35 | + run: | |
| 36 | + sudo apt-get install -y make ruby ruby-dev rubygems build-essential |
| 37 | + sudo gem install --no-document fpm |
| 38 | + sudo apt-get install -y rpm |
| 39 | +
|
| 40 | + - name: packaging APISIX(-remote) with remote code |
| 41 | + run: | |
| 42 | + make package type=rpm app=apisix version=2.7 checkout=release/2.7 image_base=centos image_tag=8 artifact=apisix-remote |
| 43 | + make package type=rpm app=apisix version=2.10.1 checkout=2.10.1 image_base=centos image_tag=8 artifact=apisix-remote |
| 44 | + make package type=rpm app=apisix version=master checkout=master image_base=centos image_tag=8 artifact=apisix-remote |
| 45 | +
|
| 46 | + - name: packaging APISIX(-local) with local code |
| 47 | + run: | |
| 48 | + git clone https://github.com/apache/apisix.git |
| 49 | + make package type=rpm app=apisix version=master checkout=master image_base=centos image_tag=8 local_code_path=./apisix artifact=apisix-local |
| 50 | +
|
| 51 | + - name: run centos8 docker and mapping rpm into container |
| 52 | + run: | |
| 53 | + docker run -itd -v $PWD/output:/output --name centos8Instance --net="host" docker.io/centos:8 /bin/bash |
| 54 | + docker exec centos8Instance bash -c "sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*" |
| 55 | + docker exec centos8Instance bash -c "sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*" |
| 56 | + docker exec centos8Instance bash -c "dnf install -y centos-release-stream" |
| 57 | + docker exec centos8Instance bash -c "dnf swap -y centos-{linux,stream}-repos" |
| 58 | + docker exec centos8Instance bash -c "dnf distro-sync -y" |
| 59 | +
|
| 60 | + - name: enable apisix repository in container |
| 61 | + run: | |
| 62 | + docker exec centos8Instance bash -c "rpm --import https://repos.apiseven.com/KEYS" |
| 63 | + docker exec centos8Instance bash -c "yum -y install https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm" |
| 64 | +
|
| 65 | + - name: install APISIX(-remote) master by rpm in container |
| 66 | + run: | |
| 67 | + docker exec centos8Instance bash -c "yum -y localinstall /output/apisix-remote-master-0.el8.x86_64.rpm" |
| 68 | + docker exec centos8Instance bash -c "apisix start" |
| 69 | +
|
| 70 | + - name: check and ensure APISIX(-remote) master is installed |
| 71 | + run: | |
| 72 | + 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') |
| 73 | + if [ ! $code -eq 200 ]; then |
| 74 | + echo "failed: failed to install Apache APISIX by rpm" |
| 75 | + exit 1 |
| 76 | + fi |
| 77 | +
|
| 78 | + - name: stop and uninstall APISIX(-remote) master |
| 79 | + run: | |
| 80 | + docker exec centos8Instance bash -c "pkill -f nginx" |
| 81 | + docker exec centos8Instance bash -c "yum -y erase apisix-remote-master" |
| 82 | +
|
| 83 | + - name: install APISIX(-remote) 2.10.1 by rpm in container |
| 84 | + run: | |
| 85 | + docker exec centos8Instance bash -c "yum -y localinstall /output/apisix-remote-2.10.1-0.el8.x86_64.rpm" |
| 86 | + docker exec centos8Instance bash -c "apisix start" |
| 87 | +
|
| 88 | + - name: check and ensure APISIX(-remote) 2.10.1 is installed |
| 89 | + run: | |
| 90 | + 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') |
| 91 | + if [ ! $code -eq 200 ]; then |
| 92 | + echo "failed: failed to install Apache APISIX by rpm" |
| 93 | + exit 1 |
| 94 | + fi |
| 95 | +
|
| 96 | + - name: stop and uninstall APISIX(-remote) 2.10.1 |
| 97 | + run: | |
| 98 | + docker exec centos8Instance bash -c "pkill -f nginx" |
| 99 | + docker exec centos8Instance bash -c "yum -y erase apisix-remote-2.10.1" |
| 100 | +
|
| 101 | + - name: install APISIX(-local) by rpm in container |
| 102 | + run: | |
| 103 | + docker exec centos8Instance bash -c "yum -y localinstall /output/apisix-local-master-0.el8.x86_64.rpm" |
| 104 | + docker exec centos8Instance bash -c "apisix start" |
| 105 | +
|
| 106 | + - name: check and ensure APISIX(-local) is installed |
| 107 | + run: | |
| 108 | + 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') |
| 109 | + if [ ! $code -eq 200 ]; then |
| 110 | + echo "failed: failed to install Apache APISIX by rpm" |
| 111 | + exit 1 |
| 112 | + fi |
0 commit comments