ci: address Opus review of the arm64 policy PR

- job timeouts 130 (cac, cac-fpm) / 80 (shared-httpd) so the retry fits; test pins the budget
- verify-image-arch.py: bounded docker calls, pull retried 3x, exit 4 'could not pull' (not an
  arch verdict), pulled image removed afterwards
- ARM64_DIGEST only taken from the first attempt when it succeeded
- comments/docs: max-parallel is per-job and unverified; guard also fires on skipped/cancelled

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-19 21:12:56 -08:00
1 parent e1ea28e6a8
commit 344c5e8d0d
5 files changed
+44 -20

No files matched your search

+25 -7
View File
@@ -12,7 +12,7 @@ no QEMU execution is needed.
Exit 0 = every --bin is an ELF64 little-endian binary of the platform's machine type.
Exit 1 = a binary is missing, not an ELF, or of the wrong architecture (or docker failed).
Exit 2 = usage.
Exit 2 = usage. Exit 4 = could not pull the image (3 attempts): no architecture verdict.
Env: DOCKER overrides the docker command (tests use a stub). Nothing in REF is ever run.
"""
import argparse
@@ -21,6 +21,8 @@ import shlex
import subprocess
import sys
import tarfile
import threading
import time
MACHINES = {'linux/arm64': (0xB7, 'AArch64'), 'linux/amd64': (0x3E, 'x86-64')}
NAMES = {0x3E: 'x86-64', 0xB7: 'AArch64', 0x03: 'x86', 0x28: 'ARM', 0xF3: 'RISC-V', 0x15: 'PowerPC64', 0x16: 'S390'}
@@ -42,14 +44,19 @@ def docker_cmd():
return shlex.split(os.environ.get('DOCKER') or 'docker')
def run(args, **kw):
return subprocess.run(docker_cmd() + args, capture_output=True, **kw)
def run(args, timeout=300):
try:
return subprocess.run(docker_cmd() + args, capture_output=True, timeout=timeout)
except subprocess.TimeoutExpired:
return subprocess.CompletedProcess(args, 124, b'', b'timed out after %ds' % timeout)
def first_bytes_of(cid, path):
"""First 64 bytes of the regular file at path (symlinks followed) inside container cid."""
p = subprocess.Popen(docker_cmd() + ['cp', '-L', '%s:%s' % (cid, path), '-'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
timer = threading.Timer(120, p.kill) # a stalled docker cp must not hang the job
timer.start()
try:
tf = tarfile.open(fileobj=p.stdout, mode='r|')
m = tf.next()
@@ -60,6 +67,7 @@ def first_bytes_of(cid, path):
err = p.stderr.read(300).decode('utf-8', 'replace').strip()
raise ValueError('cannot read %s: %s %s' % (path, e, err))
finally:
timer.cancel()
p.kill()
p.wait()
@@ -73,11 +81,19 @@ def main(argv):
a = ap.parse_args(argv)
want, label = MACHINES[a.platform]
pulled = False
if not a.no_pull:
r = run(['pull', '--quiet', '--platform', a.platform, a.image])
r = None
for attempt in range(3):
r = run(['pull', '--quiet', '--platform', a.platform, a.image], timeout=900)
if r.returncode == 0:
break
time.sleep(float(os.environ.get('VERIFY_PULL_SLEEP', '15')))
if r.returncode != 0:
print('verify-image-arch: docker pull failed: %s' % r.stderr.decode('utf-8', 'replace')[:300].strip(), file=sys.stderr)
return 1
print('verify-image-arch: could not pull %s after 3 attempts (not an architecture finding): %s' % (
a.image, r.stderr.decode('utf-8', 'replace')[:300].strip()), file=sys.stderr)
return 4
pulled = True
r = run(['create', '--platform', a.platform, '--entrypoint', '/nonexistent', a.image])
cid = r.stdout.decode().strip()
if r.returncode != 0 or not cid:
@@ -99,7 +115,9 @@ def main(argv):
else:
print('OK %s %s %s: e_machine=0x%X (%s)' % (a.image, a.platform, path, m, label))
finally:
run(['rm', '-f', cid])
run(['rm', '-f', cid], timeout=120)
if pulled:
run(['image', 'rm', a.image], timeout=120) # keep the runner disk from filling
return rc