forked from admin/ansible
ci(connectivity_tester): add multi-arch Gitea Actions workflow
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
name: Build connectivity_tester (multi-arch)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- feat/connectivity-tester
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.rudolf.keenetic.link
|
||||
IMAGE_NAME: hermes/connectivity_tester
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
if [ -n "${{ gitea.token }}" ]; then
|
||||
git clone --depth=1 --branch "${{ gitea.ref }}" \
|
||||
"https://x-access-token:${{ gitea.token }}@gitea.rudolf.keenetic.link/hermes/ansible.git" .
|
||||
fi
|
||||
|
||||
- name: Set up QEMU
|
||||
run: |
|
||||
docker run --rm --privileged tonistiigi/binfmt --install all
|
||||
docker run --rm --privileged tonistiigi/qemu-user-static --reset
|
||||
|
||||
- name: Set up Buildx
|
||||
run: |
|
||||
docker buildx create --name multiarch --use --platform \
|
||||
linux/amd64,linux/arm64 || true
|
||||
docker buildx use multiarch
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
run: |
|
||||
echo "${{ secrets.GITEA_TOKEN }}" | \
|
||||
docker login "${{ env.REGISTRY }}" -u "${{ secrets.GITEA_USERNAME }}" --password-stdin
|
||||
|
||||
- name: Resolve short SHA
|
||||
id: short
|
||||
run: echo "sha=$(git rev-parse --short=8 HEAD)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push
|
||||
run: |
|
||||
docker buildx build \
|
||||
--platform "${{ matrix.platforms }}" \
|
||||
--tag "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:auto-${{ steps.short.outputs.sha }}" \
|
||||
--tag "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" \
|
||||
--cache-from type=gha,scope=connectivity_tester \
|
||||
--cache-to type=gha,scope=connectivity_tester,mode=max \
|
||||
--file connectivity_tester/Dockerfile \
|
||||
--context connectivity_tester \
|
||||
--push \
|
||||
--provenance=false \
|
||||
.
|
||||
|
||||
- name: Inspect manifest
|
||||
run: |
|
||||
docker buildx imagetools inspect \
|
||||
"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:auto-${{ steps.short.outputs.sha }}"
|
||||
|
||||
- name: Notify brencher
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
BRENCHER_URL="${{ secrets.BRENCHER_WEBHOOK_URL }}"
|
||||
BRENCHER_TOKEN="${{ secrets.BRENCHER_WEBHOOK_TOKEN }}"
|
||||
if [ -z "$BRENCHER_URL" ]; then exit 0; fi
|
||||
curl -fsS -X POST \
|
||||
-H "Authorization: Bearer ${BRENCHER_TOKEN}" \
|
||||
"${BRENCHER_URL}/api/v1/environments/connectivity_tester/refresh"
|
||||
continue-on-error: true
|
||||
Reference in New Issue
Block a user