Answer stability round 1: 0 🔴, 2 🟡 (0 misread); run CI's image untagged and state where the socket must be

This commit is contained in:
2026-11-18 18:05:39 +01:00
parent 59c319ebb4
commit aa62b081fb
5 changed files with 13 additions and 13 deletions
+6 -6
View File
@@ -1,14 +1,14 @@
#!/bin/sh
# Runs the test suite on the committed HEAD as CI does: in a pinned Python container, as the caller's uid, so the tests that need file permissions to bind them run.
# Runs the test suite on the committed HEAD as CI does: in a pinned Python container, as the caller's uid, since root ignores file permissions and the tests that check them would fail.
# It is sh, not Python, since it runs on the CI runner's host, which needs only git and docker.
# The repo goes in as a git bundle rather than a bind mount, so the script works whether the CI runner shares the docker daemon's filesystem or not.
# The adf-codec tests run their shim's container, so the test container holds a docker client and reaches the daemon through its socket, which the daemon mounts from its own host.
# The repo goes in as a git bundle rather than a bind mount, so the runner need not share the docker daemon's filesystem.
# The adf-codec tests, which convert Jira descriptions, start a container of their own. So the test container holds a docker client and the daemon's socket.
# The daemon mounts the socket from its own host, while stat reads its group on the runner: both need it at /var/run/docker.sock.
set -eu
cd "$(dirname "$0")"
socket=/var/run/docker.sock
image="claude-config-ci:$$"
printf 'FROM docker:29.1.3-cli AS docker\nFROM python:3.14.8\nCOPY --from=docker /usr/local/bin/docker /usr/local/bin/docker\n' | docker build --quiet --memory 1g --memory-swap 1g --tag "$image" - >/dev/null
trap 'docker image rm "$image" >/dev/null' EXIT
# An untagged image, which docker image prune removes, since a cancelled run skips any cleanup.
image=$(printf 'FROM docker:29.1.3-cli AS docker\nFROM python:3.14.8\nCOPY --from=docker /usr/local/bin/docker /usr/local/bin/docker\n' | docker build --quiet --memory 1g --memory-swap 1g -)
git bundle create - HEAD | docker run --rm -i --memory 4g --memory-swap 4g --user "$(id -u):$(id -g)" --group-add "$(stat -c %g "$socket")" -v "$socket:$socket" -e HOME=/tmp "$image" sh -euc '
cat >/tmp/head.bundle
git -c init.defaultBranch=main -c advice.detachedHead=false clone --quiet /tmp/head.bundle /tmp/repo