From a1c4d5d78c2e3a6832cfe5e48476a099936c6dd1 Mon Sep 17 00:00:00 2001 From: sausheong Date: Thu, 10 Sep 2026 00:37:33 +0800 Subject: [PATCH] Provision hosted macOS Docker and avoid fixture build engine dependency --- .github/workflows/qualify.yml | 8 +++++++- scripts/QUALIFICATION.md | 19 +++++++++---------- scripts/prepare_container_fixtures.py | 19 +++++++++++-------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/.github/workflows/qualify.yml b/.github/workflows/qualify.yml index 2769519..8143911 100644 --- a/.github/workflows/qualify.yml +++ b/.github/workflows/qualify.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-15-intel] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -25,6 +25,12 @@ jobs: git status --porcelain > evidence/status.txt go version > evidence/toolchain.txt go env -json GOOS GOARCH GOVERSION > evidence/platform.json + - name: Start Docker on hosted macOS + if: runner.os == 'macOS' + run: | + brew install colima docker + colima start --runtime docker --cpu 2 --memory 4 + docker info - name: Prepare required Docker fixtures shell: bash run: | diff --git a/scripts/QUALIFICATION.md b/scripts/QUALIFICATION.md index 96375fe..e8a6096 100644 --- a/scripts/QUALIFICATION.md +++ b/scripts/QUALIFICATION.md @@ -2,15 +2,12 @@ Qualification requires a working local Docker daemon with a Unix socket and permission for the runner user to use it. The workflow prepares fixtures before -running tests and fails if the daemon is unavailable. It does not start or -provision a daemon, and does not accept skipped container tests. - -Linux GitHub runners can use their installed Docker service. A macOS runner must -have a Docker-capable environment provisioned before this workflow can succeed. -Do not assume the standard hosted macOS image provides it. See GitHub's runner -limitations: https://docs.github.com/en/actions/reference/runners/larger-runners . -Local macOS qualification remains possible using the explicitly authorised local -daemon; retain exact commit, raw results and platform identity with that evidence. +running tests and fails if the daemon is unavailable. Skipped container tests +are never accepted. Linux uses the installed Docker service. Hosted macOS uses +macos-15-intel with Colima, following Colima's own integration runner choice: +https://github.com/abiosoft/colima/blob/main/.github/workflows/macos-integration.yml +The workflow starts an ephemeral daemon on that hosted runner; it does not +register or expose a developer's machine as a self-hosted runner. The workflow pulls the named fixture base versions, resolves platform-specific immutable image IDs and records them in evidence/fixtures.json before tests. @@ -20,7 +17,9 @@ those IDs instead of resolving current tags. prepare_container_fixtures.py accepts only loaded immutable IDs, checks Linux and matching image architectures, then creates a minimal implicit-volume negative -fixture with build networking disabled. It uses a private Docker configuration +fixture by creating (never starting) a network-disabled container and committing +its VOLUME metadata. This avoids build-engine differences and registry lookups. +The temporary container is removed in a finally block. It uses a private Docker configuration and explicit socket. The generated fixtures.env is suitable for GITHUB_ENV; it contains image IDs and a local socket path, never provider credentials. diff --git a/scripts/prepare_container_fixtures.py b/scripts/prepare_container_fixtures.py index 62ce107..3ad527c 100644 --- a/scripts/prepare_container_fixtures.py +++ b/scripts/prepare_container_fixtures.py @@ -3,7 +3,6 @@ Images must already be loaded. This script never pulls images or starts a daemon. """ import argparse -import hashlib import json from pathlib import Path import re @@ -25,7 +24,10 @@ def prepare(docker, socket, image, bash_image, output): root=Path(temporary);config=root/'config';config.mkdir() prefix=[docker,'--config',str(config),'--host','unix://'+socket] def run(args): - return subprocess.check_output(prefix+args,stderr=subprocess.PIPE,timeout=120) + try: + return subprocess.check_output(prefix+args,stderr=subprocess.PIPE,timeout=120) + except subprocess.CalledProcessError as error: + raise RuntimeError(error.stderr.decode(errors='replace')) from error inspected=[] for identity in (image,bash_image): info=json.loads(run(['image','inspect',identity]))[0] @@ -34,11 +36,12 @@ def prepare(docker, socket, image, bash_image, output): inspected.append(dict(id=identity,architecture=info['Architecture'])) if inspected[0]['architecture']!=inspected[1]['architecture']: raise ValueError('fixture image architectures differ') - dockerfile=('FROM '+image+'\nVOLUME /implicit-fixture-volume\n').encode() - (root/'Dockerfile').write_bytes(dockerfile) - # Untagged derived image is identified solely by its captured ID. - raw=run(['build','--pull=false','--network=none','--quiet',str(root)]) - volume=raw.decode().strip() + # Create without starting: no process, build engine or registry lookup. + container=run(['create','--network=none',image,'/bin/true']).decode().strip() + try: + volume=run(['commit','--change','VOLUME /implicit-fixture-volume',container]).decode().strip() + finally: + run(['rm','--volumes',container]) if not re.fullmatch(r'sha256:[0-9a-f]{64}',volume): raise ValueError('derived image ID missing') info=json.loads(run(['image','inspect',volume]))[0] @@ -47,7 +50,7 @@ def prepare(docker, socket, image, bash_image, output): settings=dict(HARNESS_TEST_CONTAINER_IMAGE=image,HARNESS_TEST_BASH_IMAGE=bash_image, HARNESS_TEST_VOLUME_IMAGE=volume,HARNESS_TEST_CONTAINER_SOCKET=socket) report=dict(status='prepared',environment=settings,images=inspected, - volume_dockerfile_sha256=hashlib.sha256(dockerfile).hexdigest(), + volume_creation='commit stopped container with VOLUME /implicit-fixture-volume', note='Loaded images are retained; no tests or publication performed.') (output/'fixtures.json').write_text(json.dumps(report,indent=2)+'\n') (output/'fixtures.env').write_text(''.join(k+'='+v+'\n' for k,v in settings.items()))