Skip to content

Commit

Permalink
ci: add manual trigger to release apisix-runtime debian package (#399)
Browse files Browse the repository at this point in the history
* ci: add manual trigger to build apisix-runtime debian package (#396)

* ci: add manual trigger to build apisix-runtime debian package

* rename

* install dependencies

* rename

* change arch

* change

* use env.ARCH

* set github env

* add image arch

* set default

* use arch everywhere

* use arm64v8 image

* use linux/arm64

* use matrix.platform

* fix

* use same image diff platform

* fix

* use image name

* use debian not ubuntu

* a

* make release

* add tag name

* use matrix.platform.arch

* Update package-apisix-runtime-deb-openresty-1.21.yml (#398)

- change tag name
- add pull_request trigger

* Update package-apisix-runtime-deb-openresty-1.21.yml (#400)

* Update package-apisix-runtime-deb-openresty-1.21.yml (#401)
  • Loading branch information
Revolyssup authored Aug 20, 2024
1 parent 25c106a commit 4c58b69
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 2 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/package-apisix-runtime-deb-openresty-1.21.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: package apisix-runtime deb for debianbullseye-slim with openresty 1.21

on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for the release'
required: true
default: ''

jobs:
build:
timeout-minutes: 60
env:
BUILD_APISIX_RUNTIME_VERSION: 1.1.3
strategy:
matrix:
platform:
- runner: ubuntu-22.04
arch: amd64
- runner: buildjet-2vcpu-ubuntu-2204-arm
arch: arm64
runs-on: ${{ matrix.platform.runner }}
steps:
- uses: actions/checkout@v2
with:
ref: openresty/1.21.4

- name: Check arch
run: |
echo "ARCH: ${{ matrix.platform.arch }}"
- name: Install dependencies
run: |
sudo apt-get install -y make ruby ruby-dev rubygems build-essential
- name: Build apisix-runtime deb
run: |
if [ "${{ matrix.platform.arch }}" == "arm64" ]; then
make package type=deb app=apisix-runtime runtime_version=${BUILD_APISIX_RUNTIME_VERSION} image_base=debian image_tag=bullseye-slim arch=linux/arm64/v8
else
make package type=deb app=apisix-runtime runtime_version=${BUILD_APISIX_RUNTIME_VERSION} image_base=debian image_tag=bullseye-slim arch=linux/amd64
fi
- name: Release with Notes
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tag_name }}
body: |
Release apisix-runtime ${{ github.event.inputs.tag_name }}
files: |
./output/apisix-runtime_${{ env.BUILD_APISIX_RUNTIME_VERSION }}-0~debianbullseye-slim_${{ matrix.platform.arch }}.deb
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ ifeq ($(type), deb)
image_base="ubuntu"
image_tag="20.04"
endif

# Set arch to linux/amd64 if it's not defined
arch ?= linux/amd64
buildx=0
cache_from=type=local,src=/tmp/.buildx-cache
cache_to=type=local,dest=/tmp/.buildx-cache
Expand All @@ -54,6 +55,7 @@ define build
--build-arg IMAGE_BASE=$(image_base) \
--build-arg IMAGE_TAG=$(image_tag) \
--build-arg CODE_PATH=$(4) \
--platform $(arch) \
-f ./dockerfiles/Dockerfile.$(2).$(3) .
endef
else
Expand All @@ -69,6 +71,7 @@ define build
--load \
--cache-from=$(cache_from) \
--cache-to=$(cache_to) \
--platform $(arch) \
-f ./dockerfiles/Dockerfile.$(2).$(3) .
endef
endif
Expand All @@ -87,6 +90,7 @@ define build_runtime
--build-arg IMAGE_BASE=$(image_base) \
--build-arg IMAGE_TAG=$(image_tag) \
--build-arg CODE_PATH=$(4) \
--platform $(arch) \
-f ./dockerfiles/Dockerfile.$(2).$(3) .
endef
else
Expand All @@ -101,6 +105,7 @@ define build_runtime
--load \
--cache-from=$(cache_from) \
--cache-to=$(cache_to) \
--platform $(arch) \
-f ./dockerfiles/Dockerfile.$(2).$(3) .
endef
endif
Expand All @@ -118,6 +123,7 @@ define build-image
--build-arg OPENRESTY_NAME=$(4) \
--build-arg OPENRESTY_VERSION=$(5) \
--build-arg CODE_PATH=$(6) \
--platform $(arch) \
-f ./dockerfiles/Dockerfile.$(2).$(3) .
endef
else
Expand All @@ -129,6 +135,7 @@ define build-image
--load \
--cache-from=$(cache_from) \
--cache-to=$(cache_to) \
--platform $(arch) \
-f ./dockerfiles/Dockerfile.$(2).$(3) .
endef
endif
Expand All @@ -145,6 +152,7 @@ define package
--build-arg PACKAGE_TYPE=$(2) \
--build-arg OPENRESTY=$(openresty) \
--build-arg ARTIFACT=$(artifact) \
--platform $(arch) \
-f ./dockerfiles/Dockerfile.package.$(1) .
docker run -d --rm --name output --net="host" apache/$(1)-packaged-$(2):$(version)
docker cp output:/output ${PWD}
Expand All @@ -164,6 +172,7 @@ define package_runtime
--build-arg PACKAGE_TYPE=$(2) \
--build-arg OPENRESTY=$(openresty) \
--build-arg ARTIFACT=$(artifact) \
--platform $(arch) \
-f ./dockerfiles/Dockerfile.package.$(1) .
docker run -d --rm --name output --net="host" apache/$(1)-packaged-$(2):$(runtime_version)
docker cp output:/output ${PWD}
Expand Down Expand Up @@ -290,13 +299,14 @@ package-apisix-base-deb:
.PHONY: build-fpm
ifneq ($(buildx), True)
build-fpm:
docker build -t api7/fpm - < ./dockerfiles/Dockerfile.fpm
docker build --platform $(arch) -t api7/fpm - < ./dockerfiles/Dockerfile.fpm
else
build-fpm:
docker buildx build \
--load \
--cache-from=$(cache_from) \
--cache-to=$(cache_to) \
--platform $(arch) \
-t api7/fpm - < ./dockerfiles/Dockerfile.fpm
endif

Expand Down

0 comments on commit 4c58b69

Please sign in to comment.