GitHub answers a release asset download with HTTP 618 (jwt:expired) once the signed URL has expired, and the build layer dies on it. Two runs in a row lost build (24.04) on gh_2.106.0_linux_amd64.tar.gz while the same file downloaded fine in a sibling job of the same run. Wrap curl in /usr/local/bin with retries and a no-cache request header, which covers the Dockerfile downloads and installer scripts such as cargo-zigbuild-installer.sh. Pull request builds also read the buildcache-<base> registry cache that release.yaml writes on every main push, so a cache hit skips the downloads. Signed-off-by: fristyxd <gpg@fristy.dev>
71 lines
2.2 KiB
YAML
71 lines
2.2 KiB
YAML
name: build
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 120
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
base: ["26.10", "26.04", "24.04"]
|
|
env:
|
|
IMAGE: runner-images-test:${{ github.run_id }}-${{ matrix.base }}
|
|
REGISTRY: git.fristy.net
|
|
CACHE: git.fristy.net/actions/runner-images:buildcache-${{ matrix.base }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Log in to the registry (build cache)
|
|
run: |
|
|
token="${{ secrets.REGISTRY_TOKEN }}"
|
|
[ -n "$token" ] || { echo "REGISTRY_TOKEN secret is missing" >&2; exit 1; }
|
|
echo "$token" | docker login "${{ env.REGISTRY }}" -u "${{ secrets.REGISTRY_USERNAME || github.actor }}" --password-stdin
|
|
|
|
- name: Build ${{ matrix.base }} amd64
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
file: dockerfiles/ubuntu.dockerfile
|
|
platforms: linux/amd64
|
|
pull: true
|
|
push: false
|
|
load: true
|
|
cache-from: type=registry,ref=${{ env.CACHE }}
|
|
build-args: |
|
|
BASE_IMAGE_TAG=${{ matrix.base }}
|
|
tags: ${{ env.IMAGE }}
|
|
|
|
- name: Smoke test ${{ matrix.base }}
|
|
run: docker run --rm -i "${IMAGE}" bash -s -- ${{ matrix.base }} < tests/default.sh
|
|
|
|
- name: Scan ${{ matrix.base }} for CRITICAL vulnerabilities
|
|
run: |
|
|
docker run --rm "${IMAGE}" trivy rootfs / \
|
|
--quiet --scanners vuln --severity CRITICAL --ignore-unfixed --exit-code 1 --no-progress
|
|
|
|
- name: Report HIGH vulnerabilities for ${{ matrix.base }}
|
|
if: always()
|
|
run: |
|
|
docker run --rm "${IMAGE}" trivy rootfs / \
|
|
--quiet --scanners vuln --severity HIGH --ignore-unfixed --exit-code 1 --no-progress \
|
|
--format table || echo "HIGH findings present; not blocking the pull request"
|
|
|
|
- name: Remove test image
|
|
if: always()
|
|
run: docker image rm -f "${IMAGE}"
|