Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 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,56 @@
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: ''
pull_request:

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
Loading