Skip to content
name: package apisix rpm for ubi
on:
push:
branches: [ master ]
tags:
- "v*"
paths-ignore:
- '*.md'
pull_request:
branches: [ master ]
paths-ignore:
- '*.md'
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
APISIX_VERSION: master
services:
etcd:
image: bitnami/etcd:3.4.0
ports:
- 2379:2379
- 2380:2380
env:
ALLOW_NONE_AUTHENTICATION: yes
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: |
sudo apt-get install -y make ruby ruby-dev rubygems build-essential
sudo gem install --no-document fpm
sudo apt-get install -y rpm
- name: packaging APISIX(-remote) with remote code
run: |
wget https://raw.githubusercontent.com/apache/apisix/${APISIX_VERSION}/.requirements && source .requirements
make package type=rpm app=apisix version=master checkout=${APISIX_VERSION} runtime_version=${APISIX_RUNTIME} image_base=registry.access.redhat.com/ubi8/ubi image_tag=8.6 artifact=apisix-remote
- name: packaging APISIX(-local) with local code
run: |
wget https://raw.githubusercontent.com/apache/apisix/${APISIX_VERSION}/.requirements && source .requirements
git clone -b ${APISIX_VERSION} https://github.com/apache/apisix.git
make package type=rpm app=apisix version=master checkout=${APISIX_VERSION} runtime_version=${APISIX_RUNTIME} image_base=registry.access.redhat.com/ubi8/ubi image_tag=8.6 local_code_path=./apisix artifact=apisix-local
- name: run ubi8 docker and mapping rpm into container
run: |
docker run -itd -v $PWD/output:/output -v $(pwd)/test/apisix/config.yaml:/usr/local/apisix/conf/config.yaml --name ubiInstance --net="host" registry.access.redhat.com/ubi8/ubi:8.6 /bin/bash
- name: enable apisix repository in container
run: |
docker exec ubiInstance bash -c "rpm --import https://repos.apiseven.com/KEYS"
docker exec ubiInstance bash -c "yum -y install https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm"
- name: install APISIX(-remote) master by rpm in container
run: |
docker exec ubiInstance bash -c "yum -y localinstall /output/apisix-remote-master-0.ubi8.6.x86_64.rpm"
docker exec ubiInstance bash -c "apisix start"
- 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:9180/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) master
run: |
docker exec ubiInstance bash -c 'yum -y install procps-ng'
docker exec ubiInstance bash -c 'PIDS=$(pgrep -f nginx); for PID in $PIDS; do kill -TERM $PID; done' || echo "this echo will make exit code 0"
docker exec ubiInstance bash -c "yum -y erase apisix-remote-master"
- name: install APISIX(-local) by rpm in container
run: |
docker exec ubiInstance bash -c "yum -y localinstall /output/apisix-local-master-0.ubi8.6.x86_64.rpm"
docker exec ubiInstance bash -c "apisix start"
- name: check and ensure APISIX(-local) is installed
run: |
code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9180/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: Publish Artifact
uses: actions/[email protected]
with:
name: apisix-remote-master-0.ubi8.6.x86_64.rpm
path: output/apisix-remote-master-0.ubi8.6.x86_64.rpm
retention-days: 5
if-no-files-found: error