Skip to content

Commit d5dbfed

Browse files
authored
chore: build new dashboard ui into apisix rpm&deb package (#433)
Signed-off-by: Nic <[email protected]>
1 parent 2c3e7df commit d5dbfed

File tree

8 files changed

+53
-3
lines changed

8 files changed

+53
-3
lines changed

.github/workflows/package-apisix-deb-ubuntu20.04.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
- name: install dependencies
2828
run: |
2929
sudo apt-get install -y make
30+
# install node.js and pnpm
31+
sudo n lts
32+
corepack enable pnpm
3033
3134
- name: run apisix packaging
3235
run: |
@@ -62,6 +65,12 @@ jobs:
6265
exit 125
6366
fi
6467
68+
code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9180/ui/)
69+
if [ ! $code -eq 200 ]; then
70+
echo "failed: failed to access Apache APISIX UI"
71+
exit 1
72+
fi
73+
6574
- name: Publish Artifact
6675
uses: actions/[email protected]
6776
with:

.github/workflows/package-apisix-rpm-ubi.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
sudo apt-get install -y make ruby ruby-dev rubygems build-essential
3737
sudo gem install --no-document fpm
3838
sudo apt-get install -y rpm
39+
# install node.js and pnpm
40+
sudo n lts
41+
corepack enable pnpm
3942
4043
- name: packaging APISIX(-remote) with remote code
4144
run: |
@@ -46,6 +49,7 @@ jobs:
4649
run: |
4750
wget https://raw.githubusercontent.com/apache/apisix/${APISIX_VERSION}/.requirements && source .requirements
4851
git clone -b ${APISIX_VERSION} https://github.com/apache/apisix.git
52+
./build-apisix-dashboard.sh ./apisix
4953
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
5054
5155
- name: run ubi8 docker and mapping rpm into container
@@ -89,6 +93,12 @@ jobs:
8993
exit 1
9094
fi
9195
96+
code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9180/ui/)
97+
if [ ! $code -eq 200 ]; then
98+
echo "failed: failed to access Apache APISIX UI"
99+
exit 1
100+
fi
101+
92102
- name: Publish Artifact
93103
uses: actions/[email protected]
94104
with:

.github/workflows/publish-deb.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
- name: Init basic publish env
4141
run: |
4242
sudo apt-get update
43+
# install node.js and pnpm
44+
sudo n lts
45+
corepack enable pnpm
4346
mkdir -p "${VAR_DEB_WORKBENCH_DIR}"
4447
4548
- name: Extract Tags version

.github/workflows/publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
# install publish env deps
4141
sudo apt-get update
4242
sudo apt install -y createrepo-c
43+
# install node.js and pnpm
44+
sudo n lts
45+
corepack enable pnpm
4346
mkdir -p "${VAR_RPM_WORKBENCH_DIR}"
4447
# init env var
4548
TAG_DATE=$(date +%Y%m%d)

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
.idea
1+
.idea
2+
apisix
3+
apisix-runtime

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ endef
194194
.PHONY: build-apisix-rpm
195195
build-apisix-rpm:
196196
ifeq ($(local_code_path), 0)
197-
git clone -b $(checkout) $(apisix_repo) ./apisix
197+
git clone -b $(checkout) $(apisix_repo) --depth 1 ./apisix
198+
./build-apisix-dashboard.sh ./apisix
198199
$(call build,apisix,apisix,rpm,"./apisix")
199200
rm -fr ./apisix
200201
else
@@ -204,7 +205,8 @@ endif
204205
.PHONY: build-apisix-deb
205206
build-apisix-deb:
206207
ifeq ($(local_code_path), 0)
207-
git clone -b $(checkout) $(apisix_repo) ./apisix
208+
git clone -b $(checkout) $(apisix_repo) --depth 1 ./apisix
209+
./build-apisix-dashboard.sh ./apisix
208210
$(call build,apisix,apisix,deb,"./apisix")
209211
rm -fr ./apisix
210212
else

build-apisix-dashboard.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
set -x
4+
5+
cd $1
6+
source .requirements
7+
if [ -z "${APISIX_DASHBOARD_COMMIT:-}" ]; then
8+
echo "Error: APISIX_DASHBOARD_COMMIT is not set or empty"
9+
exit 1
10+
fi
11+
git clone --revision=${APISIX_DASHBOARD_COMMIT} --depth 1 https://github.com/apache/apisix-dashboard.git
12+
pushd apisix-dashboard
13+
# compile
14+
pnpm install --frozen-lockfile
15+
pnpm run build
16+
popd
17+
# copy the dist files to the ui directory
18+
mkdir ui
19+
cp -r apisix-dashboard/dist/* ui/
20+
rm -rf apisix-dashboard

utils/install-common.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ install_apisix() {
105105
sed -i "1s@.*@$bin@" /tmp/build/output/apisix/usr/bin/apisix
106106
fi
107107
cp -r /usr/local/apisix/* /tmp/build/output/apisix/usr/local/apisix/
108+
cp -r /apisix/ui /tmp/build/output/apisix/usr/local/apisix/ui
108109
mv /tmp/build/output/apisix/usr/local/apisix/deps/share/lua/5.1/apisix /tmp/build/output/apisix/usr/local/apisix/
109110
if is_newer_version "${checkout_v}"; then
110111
bin='package.path = "/usr/local/apisix/?.lua;" .. package.path'

0 commit comments

Comments
 (0)