-
Notifications
You must be signed in to change notification settings - Fork 96
98 lines (84 loc) · 4.06 KB
/
package-apisix-rpm-ubi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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