Skip to content

Commit

Permalink
feat: support new package APISIX-runtime (#342)
Browse files Browse the repository at this point in the history
Signed-off-by: Sn0rt <[email protected]>
  • Loading branch information
Sn0rt authored Oct 26, 2023
1 parent f16707b commit a32bc50
Show file tree
Hide file tree
Showing 20 changed files with 1,097 additions and 40 deletions.
98 changes: 95 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
name: package apisix-base
command: |
make package type=deb app=apisix-base version=${TEST_VERSION}
- run:
name: package apisix-runtime
command: |
make package type=deb app=apisix-runtime version=${TEST_VERSION}
- run:
name: package apisx
command: |
Expand Down Expand Up @@ -73,6 +77,27 @@ jobs:
--build-arg VERSION=dev --build-arg BUILD_LATEST=latest \
-f ./dockerfiles/Dockerfile.apisix-base.deb .
build-and-push-apisix-runtime-dev-arm:
machine:
image: ubuntu-2004:202101-01
resource_class: arm.medium

steps:
- checkout
- run:
name: submodule
command: |
git submodule sync
git submodule update --init
- run:
name: Build and Push Docker Image
command: |
echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker buildx build -t api7/apisix-runtime:dev-arm64 --push \
--build-arg VERSION=dev --build-arg BUILD_LATEST=latest \
-f ./dockerfiles/Dockerfile.apisix-runtime.deb .
build-and-push-apisix-base-dev-x86:
machine:
image: ubuntu-2004:202101-01
Expand All @@ -94,13 +119,34 @@ jobs:
--build-arg VERSION=dev --build-arg BUILD_LATEST=latest \
-f ./dockerfiles/Dockerfile.apisix-base.deb .
upload-manifest:
build-and-push-apisix-runtime-dev-x86:
machine:
image: ubuntu-2004:202101-01
resource_class: medium

steps:
- checkout
- run:
name: submodule
command: |
git submodule sync
git submodule update --init
- run:
name: Build and Push Docker Image
command: |
echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker buildx build -t api7/apisix-runtime:dev-x86_64 --push \
--build-arg VERSION=dev --build-arg BUILD_LATEST=latest \
-f ./dockerfiles/Dockerfile.apisix-runtime.deb .
upload-manifest-apisix-base-dev:
docker:
- image: cimg/python:3.8.2
steps:
- checkout
- deploy:
name: "Upload manifest to registry"
name: "Upload apisix-base manifest to registry"
command: |
set -eu
export DOCKER_CLI_EXPERIMENTAL=enabled
Expand All @@ -110,6 +156,22 @@ jobs:
api7/apisix-base:dev-x86_64
docker manifest push api7/apisix-base:dev
upload-manifest-apisix-runtime-dev:
docker:
- image: cimg/python:3.8.2
steps:
- checkout
- deploy:
name: "Upload apisix-runtime manifest to registry"
command: |
set -eu
export DOCKER_CLI_EXPERIMENTAL=enabled
echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker manifest create api7/apisix-runtime:dev \
api7/apisix-runtime:dev-arm64 \
api7/apisix-runtime:dev-x86_64
docker manifest push api7/apisix-runtime:dev
build-arm64-package:
parameters:
var_os:
Expand Down Expand Up @@ -178,6 +240,21 @@ jobs:
- store_artifacts:
path: /tmp/output

- when:
condition:
matches: { pattern: "^apisix-runtime/(.*)\\d+$", value: << pipeline.git.tag >> }
steps:
- run:
name: build apisix-runtime package
command: |
APISIX_RUNTIME_TAG_VERSION=$(echo ${CIRCLE_TAG##*/})
echo "apisix-runtime version: $APISIX_RUNTIME_TAG_VERSION"
make package type=${PACK_TYPE} app=apisix-runtime checkout=${APISIX_RUNTIME_TAG_VERSION} version=${APISIX_RUNTIME_TAG_VERSION} image_base=<< parameters.var_os >> image_tag=<< parameters.var_os_release >>
mv ./output/apisix-runtime*.${PACK_TYPE} ${VAR_WORKBENCH_DIR}
- store_artifacts:
path: /tmp/output

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
Expand All @@ -198,10 +275,25 @@ workflows:
jobs:
- build-and-push-apisix-base-dev-arm
- build-and-push-apisix-base-dev-x86
- upload-manifest:
- upload-manifest-apisix-base-dev:
requires:
- build-and-push-apisix-base-dev-arm
- build-and-push-apisix-base-dev-x86
build-and-push-apisix-runtime-dev:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- build-and-push-apisix-runtime-dev-arm
- build-and-push-apisix-runtime-dev-x86
- upload-manifest-apisix-runtime-dev:
requires:
- build-and-push-apisix-runtime-dev-arm
- build-and-push-apisix-runtime-dev-x86
build-mutil-platform-arm64-apckage:
jobs:
- build-arm64-package:
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/package-apisix-runtime-deb-ubuntu20.04.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: package apisix-runtime deb for ubuntu 20.04(Focal Fossa)

on:
push:
branches: [ master ]
tags:
- "v*"
paths-ignore:
- '*.md'
pull_request:
branches: [ master ]
paths-ignore:
- '*.md'
schedule:
- cron: '0 0 * * *'

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
BUILD_APISIX_RUNTIME_VERSION: 1.0.0
steps:
- uses: actions/checkout@v2

- name: install dependencies
run: |
sudo apt-get install -y make ruby ruby-dev rubygems build-essential
- name: build apisix-runtime deb
run: |
make package type=deb app=apisix-runtime version=${BUILD_APISIX_RUNTIME_VERSION} image_base=ubuntu image_tag=20.04
- name: run ubuntu 20.04 docker and mapping apisix-runtime deb into container
run: |
docker run -itd -v /home/runner/work/apisix-build-tools/apisix-build-tools/output:/output --name ubuntu20.04Instance --net="host" docker.io/ubuntu:20.04 /bin/bash
- name: install dependencies in container
run: |
docker exec ubuntu20.04Instance bash -c "DEBIAN_FRONTEND=noninteractive apt-get update"
docker exec ubuntu20.04Instance bash -c "DEBIAN_FRONTEND=noninteractive apt-get install -y libreadline-dev lsb-release libssl-dev perl build-essential"
docker exec ubuntu20.04Instance bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends wget gnupg ca-certificates"
docker exec ubuntu20.04Instance bash -c "wget -O - https://openresty.org/package/pubkey.gpg | apt-key add -"
docker exec ubuntu20.04Instance bash -c 'echo "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/openresty.list'
docker exec ubuntu20.04Instance bash -c "DEBIAN_FRONTEND=noninteractive apt-get update"
docker exec ubuntu20.04Instance bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y install openresty-openssl111 openresty-pcre openresty-zlib"
- name: install deb in container
run: |
docker exec ubuntu20.04Instance bash -c "dpkg -i /output/apisix-runtime_${BUILD_APISIX_RUNTIME_VERSION}-0~ubuntu20.04_amd64.deb"
- name: check and ensure apisix-runtime is installed
run: |
docker exec ubuntu20.04Instance bash -c "/usr/local/openresty/bin/etcdctl -h" || exit 1
export APISIX_RUNTIME_VER=$(docker exec ubuntu20.04Instance bash -c "openresty -V" 2>&1 | awk '/-O2 -DAPISIX_RUNTIME_VER=/{print $5}' | awk -v FS="=" '{print $2}')
if [ "$APISIX_RUNTIME_VER" != "${BUILD_APISIX_RUNTIME_VERSION}" ]; then exit 1; fi
- name: Publish Artifact
uses: actions/[email protected]
with:
name: apisix-runtime_${{ env.BUILD_APISIX_RUNTIME_VERSION }}-0~ubuntu20.04_amd64.deb
path: output/apisix-runtime_${{ env.BUILD_APISIX_RUNTIME_VERSION }}-0~ubuntu20.04_amd64.deb
retention-days: 5
if-no-files-found: error
59 changes: 59 additions & 0 deletions .github/workflows/package-apisix-runtime-rpm-el7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: package apisix-runtime rpm for el7

on:
push:
branches: [ master ]
tags:
- "v*"
paths-ignore:
- '*.md'
pull_request:
branches: [ master ]
paths-ignore:
- '*.md'
schedule:
- cron: '0 0 * * *'

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
BUILD_APISIX_RUNTIME_VERSION: 1.0.0
steps:
- uses: actions/checkout@v2

- name: install dependencies
run: |
sudo apt-get install -y make ruby ruby-dev rubygems build-essential
- name: build apisix-runtime rpm
run: |
make package type=rpm app=apisix-runtime version=${BUILD_APISIX_RUNTIME_VERSION} image_base=centos image_tag=7
- name: run centos7 docker and mapping apisix-runtime rpm into container
run: |
docker run -itd -v /home/runner/work/apisix-build-tools/apisix-build-tools/output:/output --name centos7Instance --net="host" docker.io/centos:7 /bin/bash
- name: install dependencies in container
run: |
docker exec centos7Instance bash -c "yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo"
docker exec centos7Instance bash -c "yum -y install openresty-openssl111 openresty-pcre openresty-zlib"
- name: install rpm in container
run: |
docker exec centos7Instance bash -c "yum -y localinstall /output/apisix-runtime-${BUILD_APISIX_RUNTIME_VERSION}-0.el7.x86_64.rpm"
- name: check and ensure apisix-runtime is installed
run: |
docker exec centos7Instance bash -c "/usr/local/openresty/bin/etcdctl -h" || exit 1
export APISIX_RUNTIME_VER=$(docker exec centos7Instance bash -c "openresty -V" 2>&1 | awk '/-O2 -DAPISIX_RUNTIME_VER=/{print $5}' | awk -v FS="=" '{print $2}')
if [ "$APISIX_RUNTIME_VER" != "${BUILD_APISIX_RUNTIME_VERSION}" ]; then exit 1; fi
- name: Publish Artifact
uses: actions/[email protected]
with:
name: apisix-runtime-${{ env.BUILD_APISIX_RUNTIME_VERSION }}-0.el7.x86_64.rpm
path: output/apisix-runtime-${{ env.BUILD_APISIX_RUNTIME_VERSION }}-0.el7.x86_64.rpm
retention-days: 5
if-no-files-found: error
66 changes: 66 additions & 0 deletions .github/workflows/package-apisix-runtime-rpm-el8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: package apisix-runtime rpm for el8

on:
push:
branches: [ master ]
tags:
- "v*"
paths-ignore:
- '*.md'
pull_request:
branches: [ master ]
paths-ignore:
- '*.md'
schedule:
- cron: '0 0 * * *'

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
BUILD_APISIX_RUNTIME_VERSION: 1.0.0
steps:
- uses: actions/checkout@v2

- name: install dependencies
run: |
sudo apt-get install -y make ruby ruby-dev rubygems build-essential
- name: build apisix-runtime rpm
run: |
make package type=rpm app=apisix-runtime version=${BUILD_APISIX_RUNTIME_VERSION} image_base=centos image_tag=8
- name: run centos8 docker and mapping apisix-runtime rpm into container
run: |
docker run -itd -v /home/runner/work/apisix-build-tools/apisix-build-tools/output:/output --name centos8Instance --net="host" docker.io/centos:8 /bin/bash
- name: install dependencies in container
run: |
docker exec centos8Instance bash -c "sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*"
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-*"
docker exec centos8Instance bash -c "dnf install -y centos-release-stream"
docker exec centos8Instance bash -c "dnf swap -y centos-{linux,stream}-repos"
docker exec centos8Instance bash -c "dnf distro-sync -y"
docker exec centos8Instance bash -c "dnf install -y yum-utils"
docker exec centos8Instance bash -c "yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo"
docker exec centos8Instance bash -c "yum -y install openresty-openssl111 openresty-pcre openresty-zlib"
- name: install rpm in container
run: |
docker exec centos8Instance bash -c "yum -y localinstall /output/apisix-runtime-${BUILD_APISIX_RUNTIME_VERSION}-0.el8.x86_64.rpm"
- name: check and ensure apisix-runtime is installed
run: |
docker exec centos8Instance bash -c "/usr/local/openresty/bin/etcdctl -h" || exit 1
export APISIX_RUNTIME_VER=$(docker exec centos8Instance bash -c "openresty -V" 2>&1 | awk '/-O2 -DAPISIX_RUNTIME_VER=/{print $5}' | awk -v FS="=" '{print $2}')
if [ "$APISIX_RUNTIME_VER" != "${BUILD_APISIX_RUNTIME_VERSION}" ]; then exit 1; fi
- name: Publish Artifact
uses: actions/[email protected]
with:
name: apisix-runtime-${{ env.BUILD_APISIX_RUNTIME_VERSION }}-0.el8.x86_64.rpm
path: output/apisix-runtime-${{ env.BUILD_APISIX_RUNTIME_VERSION }}-0.el8.x86_64.rpm
retention-days: 5
if-no-files-found: error
59 changes: 59 additions & 0 deletions .github/workflows/package-apisix-runtime-rpm-ubi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: package apisix-runtime 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:
BUILD_APISIX_RUNTIME_VERSION: 1.0.0
steps:
- uses: actions/checkout@v2

- name: install dependencies
run: |
sudo apt-get install -y make ruby ruby-dev rubygems build-essential
- name: build apisix-runtime rpm
run: |
make package type=rpm app=apisix-runtime version=${BUILD_APISIX_RUNTIME_VERSION} image_base=registry.access.redhat.com/ubi8/ubi image_tag=8.6
- name: run ubi8 docker and mapping apisix-runtime rpm into container
run: |
docker run -itd -v /home/runner/work/apisix-build-tools/apisix-build-tools/output:/output --name ubiInstance --net="host" registry.access.redhat.com/ubi8/ubi:8.6 /bin/bash
- name: install dependencies in container
run: |
docker exec ubiInstance bash -c "dnf install -y yum-utils"
docker exec ubiInstance bash -c "yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo"
docker exec ubiInstance bash -c "yum -y install openresty-openssl111 openresty-pcre openresty-zlib"
- name: install rpm in container
run: |
docker exec ubiInstance bash -c "ls -la /output"
docker exec ubiInstance bash -c "yum -y localinstall /output/apisix-runtime-${BUILD_APISIX_RUNTIME_VERSION}-0.ubi8.6.x86_64.rpm"
- name: check and ensure apisix-runtime is installed
run: |
docker exec ubiInstance bash -c "/usr/local/openresty/bin/etcdctl -h" || exit 1
export APISIX_RUNTIME_VER=$(docker exec ubiInstance bash -c "openresty -V" 2>&1 | awk '/-O2 -DAPISIX_RUNTIME_VER=/{print $5}' | awk -v FS="=" '{print $2}')
if [ "$APISIX_RUNTIME_VER" != "${BUILD_APISIX_RUNTIME_VERSION}" ]; then exit 1; fi
- name: Publish Artifact
uses: actions/[email protected]
with:
name: apisix-runtime-${{ env.BUILD_APISIX_RUNTIME_VERSION }}-0.ubi8.6.x86_64.rpm
path: output/apisix-runtime-${{ env.BUILD_APISIX_RUNTIME_VERSION }}-0.ubi8.6.x86_64.rpm
retention-days: 5
if-no-files-found: error
Loading

0 comments on commit a32bc50

Please sign in to comment.