ci(connectivity_tester): rewrite workflow to use REGISTRY_* secrets + multi-arch

Aligns with the proven hermes/reverseproxy@main build.yml: uses
secrets.REGISTRY_USERNAME/REGISTRY_PASSWORD (which already exist in the
cluster-wide Actions runner scope), docker/setup-buildx-action@v3 and
docker/build-push-action@v6 from docker/github-mirror, and targets the
gitea.rudolf.keenetic.link/<image>:auto-<sha> plus :latest tags.

Multi-arch matrix now covers linux/amd64, linux/arm64 and linux/arm/v7
so push to Gitea Container Registry will fan out to rudolf-T (x86_64),
odroid (aarch64) and xu4 (32-bit ARM).
This commit is contained in:
2026-09-15 21:06:24 +02:00
parent bf6b86302f
commit b5b94b2eee
+65 -53
View File
@@ -1,79 +1,91 @@
name: Build connectivity_tester (multi-arch)
name: build connectivity_tester (multi-arch)
on:
workflow_dispatch:
inputs:
ref:
description: Git ref to build
required: true
default: feat/connectivity-tester
image_name:
description: Image name (e.g. hermes/connectivity_tester)
required: true
default: hermes/connectivity_tester
push_stackfile:
description: Upload rendered stack-compose as artifact
required: false
type: string
default: "true"
push:
branches:
- feat/connectivity-tester
workflow_dispatch:
env:
REGISTRY: gitea.rudolf.keenetic.link
IMAGE_NAME: hermes/connectivity_tester
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platforms:
platform:
- linux/amd64
- linux/arm64
- linux/arm/v7
outputs:
image_tag: ${{ steps.tag.outputs.value }}
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
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref || github.ref }}
fetch-depth: 0
- name: Set up QEMU
run: |
docker run --rm --privileged tonistiigi/binfmt --install all
docker run --rm --privileged tonistiigi/qemu-user-static --reset
- name: Resolve image tag
id: tag
run: echo "value=auto-${GITHUB_SHA::8}" >> "$GITHUB_OUTPUT"
- name: Set up Buildx
run: |
docker buildx create --name multiarch --use --platform \
linux/amd64,linux/arm64 || true
docker buildx use multiarch
- name: Resolve image_name
id: name
run: echo "value=${{ github.event.inputs.image_name || 'hermes/connectivity_tester' }}" >> "$GITHUB_OUTPUT"
- name: Login to Gitea Container Registry
run: |
echo "${{ secrets.GITEA_TOKEN }}" | \
docker login "${{ env.REGISTRY }}" -u "${{ secrets.GITEA_USERNAME }}" --password-stdin
echo "${{ secrets.REGISTRY_PASSWORD }}" | \
docker login "gitea.rudolf.keenetic.link" \
-u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
- name: Resolve short SHA
id: short
run: echo "sha=$(git rev-parse --short=8 HEAD)" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: connectivity_tester
file: connectivity_tester/Dockerfile
platforms: ${{ matrix.platform }}
push: true
tags: |
gitea.rudolf.keenetic.link/${{ steps.name.outputs.value }}:${{ steps.tag.outputs.value }}
gitea.rudolf.keenetic.link/${{ steps.name.outputs.value }}:latest
cache-from: |
type=registry,ref=gitea.rudolf.keenetic.link/${{ steps.name.outputs.value }}:buildcache
cache-to: |
type=registry,ref=gitea.rudolf.keenetic.link/${{ steps.name.outputs.value }}:buildcache,mode=max
- name: Render stackfile with image tag
if: github.event.inputs.push_stackfile != 'false'
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 \
.
mkdir -p out
sed "s|\${version}|${{ steps.tag.outputs.value }}|g" \
connectivity_tester/stack-compose.yml \
> "out/docker-compose-${{ steps.tag.outputs.value }}.yml"
- 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
- name: Upload rendered stackfile
if: github.event.inputs.push_stackfile != 'false'
uses: actions/upload-artifact@v4
with:
name: stack-compose
path: out/