From acb83176216e622268b06e5a53759635a3ddf564 Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Thu, 26 Nov 2026 09:19:40 -0700 Subject: [PATCH 1/3] Boot-test the arm64 images before they get a tag The smoke test ran on the amd64 image only, so an arm64-only break could still reach -latest. - smoke-test.sh takes an optional platform (linux/amd64 or linux/arm64), passes it to every docker run and checks uname -m against it. - The frankenphp build legs boot the arm64 image on their native arm64 runner before uploading its digest. A failure leaves no arm64 digest, so the merge job fails and the tags stay where they were. - The cli images boot their arm64 image under the QEMU the build already uses. - The amd64 checks pass linux/amd64, so they check the architecture too. Refs ALI-1113 --- .github/scripts/smoke-test.sh | 60 ++++++++++++++++++------ .github/workflows/build-and-push.yml | 70 +++++++++++++++++++++++----- README.md | 2 +- 3 files changed, 106 insertions(+), 26 deletions(-) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index 314c9d3..4eb839e 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -3,8 +3,9 @@ # image never gets a floating tag. Run by build-and-push.yml between pushing an # image by digest and tagging it; also runnable by hand: # -# .github/scripts/smoke-test.sh +# .github/scripts/smoke-test.sh [] # .github/scripts/smoke-test.sh wordpress ghcr.io/aliasproject/php:8.4-frankenphp-wordpress 8.4 +# .github/scripts/smoke-test.sh cli ghcr.io/aliasproject/php:8.4-cli 8.4 linux/arm64 # # variant: cli | base | dev | wordpress | wordpress-dev # cli runs php; no server @@ -12,15 +13,29 @@ # wordpress, wordpress-dev Tier 1 plus the WordPress extension set # The frankenphp variants are booted and served over HTTP, so the PHP that is # checked is the one embedded in the server (not the separate `php` binary). +# platform (optional, linux/amd64 or linux/arm64) is passed to every docker run +# as --platform, and the container's architecture is checked against it. Without +# it, docker runs the image for the host's own architecture. A platform other +# than the host's needs QEMU (binfmt) set up on the host. set -euo pipefail -if [ "$#" -ne 3 ]; then - echo "usage: $0 " >&2 +if [ "$#" -lt 3 ] || [ "$#" -gt 4 ]; then + echo "usage: $0 []" >&2 exit 2 fi variant=$1 image=$2 php_version=$3 +platform=${4:-} + +platform_args=() +expected_arch= +case "$platform" in + "") ;; + linux/amd64) platform_args=(--platform "$platform"); expected_arch=x86_64 ;; + linux/arm64) platform_args=(--platform "$platform"); expected_arch=aarch64 ;; + *) echo "unknown platform: $platform (expected linux/amd64 or linux/arm64)" >&2; exit 2 ;; +esac tier1="pdo_mysql zip intl bcmath pcntl posix" wordpress_ext="mysqli gd exif imagick redis igbinary soap" @@ -31,7 +46,22 @@ case "$variant" in *) echo "unknown variant: $variant" >&2; exit 2 ;; esac -fail() { echo "SMOKE TEST FAILED ($variant, $image): $*" >&2; exit 1; } +fail() { echo "SMOKE TEST FAILED ($variant, $image${platform:+, $platform}): $*" >&2; exit 1; } + +# With a platform, pull that platform's image first. Without this, a docker +# engine that keeps one image per name (the classic image store) can find the +# other architecture's image, pulled for an earlier run of this script, under +# the same name. The check_arch below would then fail. A pull that fails (an +# image that only exists locally, say) is left to docker run to report. +if [ -n "$platform" ]; then + docker pull --quiet --platform "$platform" "$image" >/dev/null 2>&1 || true +fi + +# uname -m inside the container ($1) against the requested platform. +check_arch() { + [ -n "$expected_arch" ] || return 0 + [ "$1" = "$expected_arch" ] || fail "architecture is '$1', expected $expected_arch for $platform" +} # Shared checks on a PHP version string and a list of loaded extensions. check_php() { @@ -49,16 +79,18 @@ check_php() { } if [ "$variant" = cli ]; then - version=$(docker run --rm "$image" php -r 'echo PHP_VERSION;') || fail "php did not run" - loaded=$(docker run --rm "$image" php -m | tr '\n' ' ') || fail "php -m did not run" + version=$(docker run --rm "${platform_args[@]}" "$image" php -r 'echo PHP_VERSION;') || fail "php did not run" + loaded=$(docker run --rm "${platform_args[@]}" "$image" php -m | tr '\n' ' ') || fail "php -m did not run" check_php "$version" "$loaded" - uid=$(docker run --rm "$image" id -u) || fail "id did not run" + uid=$(docker run --rm "${platform_args[@]}" "$image" id -u) || fail "id did not run" [ "$uid" != 0 ] || fail "runs as root" + arch=$(docker run --rm "${platform_args[@]}" "$image" uname -m) || fail "uname did not run" + check_arch "$arch" # Only cli/Dockerfile.wordpress carries the WORDPRESS_VCS_CHECKOUT prepend # file (see the frankenphp checks below). CI doesn't build that image, so # this runs only by hand. A docker run that fails fails the check, rather # than reading as "no file". - has_vcs=$(docker run --rm "$image" sh -c \ + has_vcs=$(docker run --rm "${platform_args[@]}" "$image" sh -c \ 'if test -f /usr/local/share/php-prepend/wordpress-vcs-checkout.php; then echo yes; else echo no; fi') \ || fail "the WORDPRESS_VCS_CHECKOUT file check did not run" case "$has_vcs" in @@ -68,12 +100,12 @@ if [ "$variant" = cli ]; then if [ "$has_vcs" = yes ]; then seeded='{"automatic_updates_is_vcs_checkout":{"10":[{"function":"__return_true","accepted_args":1}]}}' check='echo " /tmp/vcs.php && php /tmp/vcs.php' - out=$(docker run --rm "$image" sh -c "$check") || fail "vcs check did not run" + out=$(docker run --rm "${platform_args[@]}" "$image" sh -c "$check") || fail "vcs check did not run" [ "$out" = none ] || fail "WORDPRESS_VCS_CHECKOUT unset, but the filter was seeded: $out" - out=$(docker run --rm -e WORDPRESS_VCS_CHECKOUT=1 "$image" sh -c "$check") || fail "vcs check did not run" + out=$(docker run --rm "${platform_args[@]}" -e WORDPRESS_VCS_CHECKOUT=1 "$image" sh -c "$check") || fail "vcs check did not run" [ "$out" = "$seeded" ] || fail "WORDPRESS_VCS_CHECKOUT=1 did not seed the filter: $out" fi - echo "ok: $image (PHP $version, uid $uid)" + echo "ok: $image (PHP $version, uid $uid, $arch)" exit 0 fi @@ -120,7 +152,7 @@ boot() { # wait below much longer than it needs to be. docker run -d --name "$cname" -p 127.0.0.1::80 -v "$fixture:/app:ro" \ --health-interval 2s --health-timeout 5s --health-retries 5 --health-start-period 30s \ - "$@" "$image" >/dev/null + "${platform_args[@]}" "$@" "$image" >/dev/null for _ in $(seq 1 60); do state=$(docker inspect -f '{{.State.Status}}' "$cname") @@ -152,6 +184,8 @@ check_php "$version" "$loaded" uid=$(docker exec "$name" id -u) [ "$uid" != 0 ] || fail "runs as root" +arch=$(docker exec "$name" uname -m) || fail "uname did not run" +check_arch "$arch" # PHP under /storage/ never executes, but ordinary files there are still served # and other /storage/ URLs still reach the app (Laravel's local-disk serve route). @@ -209,4 +243,4 @@ vcs_case "$seeded" -e WORDPRESS_VCS_CHECKOUT=1 vcs_case "$seeded" -e WORDPRESS_VCS_CHECKOUT=1 -e PHP_OPEN_BASEDIR=/app:/tmp vcs_case none -e WORDPRESS_VCS_CHECKOUT=1 -e PHP_DISABLE_FUNCTIONS=getenv -echo "ok: $image (PHP $version, uid $uid, healthy, WORDPRESS_VCS_CHECKOUT)" +echo "ok: $image (PHP $version, uid $uid, $arch, healthy, WORDPRESS_VCS_CHECKOUT)" diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 31c7a3d..e9e63cb 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -144,13 +144,25 @@ jobs: cache-from: type=gha,scope=${{ matrix.name }} cache-to: type=gha,mode=max,scope=${{ matrix.name }} - - name: Smoke test ${{ matrix.name }} + - name: Smoke test ${{ matrix.name }} (amd64) if: ${{ steps.build.outcome == 'success' }} run: | tag="${{ matrix.tag }}" .github/scripts/smoke-test.sh cli \ "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}" \ - "${tag%%-*}" + "${tag%%-*}" linux/amd64 + + # The arm64 image runs under the QEMU set up above for the build. The + # cli checks are a handful of short `docker run`s with no server or + # timeouts, far lighter than the emulated extension compile the build + # step has already survived. + - name: Smoke test ${{ matrix.name }} (arm64, QEMU) + if: ${{ steps.build.outcome == 'success' && contains(matrix.platforms, 'arm64') }} + run: | + tag="${{ matrix.tag }}" + .github/scripts/smoke-test.sh cli \ + "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}" \ + "${tag%%-*}" linux/arm64 - name: Tag ${{ matrix.name }} if: ${{ steps.build.outcome == 'success' }} @@ -218,6 +230,17 @@ jobs: cache-from: type=gha,scope=8.${{ matrix.version }}-frankenphp-${{ matrix.arch }} cache-to: type=gha,mode=max,scope=8.${{ matrix.version }}-frankenphp-${{ matrix.arch }} + # Boot the arm64 image here, on the native arm64 runner that built it, + # before its digest is uploaded: the merge job runs on amd64 and boots + # only the amd64 image. A failure leaves no arm64 digest, so the merge + # job fails at its download and the floating tags stay where they were. + - name: Smoke test (arm64) + if: ${{ matrix.arch == 'arm64' && steps.build.outcome == 'success' }} + run: | + .github/scripts/smoke-test.sh base \ + "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}" \ + "${{ matrix.version }}" linux/arm64 + - name: Export digest if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} run: | @@ -283,9 +306,9 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} # Boot the amd64 image (the runner's own architecture) before it gets - # any tag. A failure here leaves the existing floating tags untouched, - # and holds back the images built FROM this one (their jobs need this - # one to succeed). + # any tag; the arm64 image was booted in its build leg. A failure here + # leaves the existing floating tags untouched, and holds back the images + # built FROM this one (their jobs need this one to succeed). - name: Checkout smoke test script if: ${{ steps.digest_amd64.outcome == 'success' }} uses: actions/checkout@v7 @@ -297,7 +320,7 @@ jobs: run: | .github/scripts/smoke-test.sh "base" \ "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:$(find /tmp/digests/amd64 -type f -printf '%f')" \ - "${{ matrix.version }}" + "${{ matrix.version }}" linux/amd64 - name: Create manifest list and push if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} @@ -396,6 +419,17 @@ jobs: cache-from: type=gha,scope=${{ matrix.version }}-frankenphp-${{ matrix.variant }}-${{ matrix.arch }} cache-to: type=gha,mode=max,scope=${{ matrix.version }}-frankenphp-${{ matrix.variant }}-${{ matrix.arch }} + # Boot the arm64 image here, on the native arm64 runner that built it, + # before its digest is uploaded: the merge job runs on amd64 and boots + # only the amd64 image. A failure leaves no arm64 digest, so the merge + # job fails at its download and the floating tags stay where they were. + - name: Smoke test (arm64) + if: ${{ matrix.arch == 'arm64' && steps.build.outcome == 'success' }} + run: | + .github/scripts/smoke-test.sh "${{ matrix.variant }}" \ + "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}" \ + "${{ matrix.version }}" linux/arm64 + - name: Export digest if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} run: | @@ -463,9 +497,9 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} # Boot the amd64 image (the runner's own architecture) before it gets - # any tag. A failure here leaves the existing floating tags untouched, - # and holds back the images built FROM this one (their jobs need this - # one to succeed). + # any tag; the arm64 image was booted in its build leg. A failure here + # leaves the existing floating tags untouched, and holds back the images + # built FROM this one (their jobs need this one to succeed). - name: Checkout smoke test script if: ${{ steps.digest_amd64.outcome == 'success' }} uses: actions/checkout@v7 @@ -477,7 +511,7 @@ jobs: run: | .github/scripts/smoke-test.sh "${{ matrix.variant }}" \ "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:$(find /tmp/digests/amd64 -type f -printf '%f')" \ - "${{ matrix.version }}" + "${{ matrix.version }}" linux/amd64 - name: Create manifest list and push if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} @@ -562,6 +596,17 @@ jobs: cache-from: type=gha,scope=${{ matrix.version }}-frankenphp-${{ matrix.variant }}-${{ matrix.arch }} cache-to: type=gha,mode=max,scope=${{ matrix.version }}-frankenphp-${{ matrix.variant }}-${{ matrix.arch }} + # Boot the arm64 image here, on the native arm64 runner that built it, + # before its digest is uploaded: the merge job runs on amd64 and boots + # only the amd64 image. A failure leaves no arm64 digest, so the merge + # job fails at its download and the floating tags stay where they were. + - name: Smoke test (arm64) + if: ${{ matrix.arch == 'arm64' && steps.build.outcome == 'success' }} + run: | + .github/scripts/smoke-test.sh "${{ matrix.variant }}" \ + "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}" \ + "${{ matrix.version }}" linux/arm64 + - name: Export digest if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} run: | @@ -624,7 +669,8 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} # Boot the amd64 image (the runner's own architecture) before it gets - # any tag. A failure here leaves the existing floating tags untouched. + # any tag; the arm64 image was booted in its build leg. A failure here + # leaves the existing floating tags untouched. - name: Checkout smoke test script if: ${{ steps.digest_amd64.outcome == 'success' }} uses: actions/checkout@v7 @@ -636,7 +682,7 @@ jobs: run: | .github/scripts/smoke-test.sh "${{ matrix.variant }}" \ "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:$(find /tmp/digests/amd64 -type f -printf '%f')" \ - "${{ matrix.version }}" + "${{ matrix.version }}" linux/amd64 - name: Create manifest list and push if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} diff --git a/README.md b/README.md index ed5b340..f20b0fc 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Docker images for PHP, published to `ghcr.io/aliasproject/php`. The primary offe | 8.4 | ✅ | ✅ | ✅ | ✅ | | 8.5 | ✅ | ✅ | ✅ | ✅ | -Tags follow `-` (e.g. `8.4-frankenphp-wordpress`), each also published as `-latest` and as `-` for the commit it was built from. Every image is rebuilt weekly (Mondays 10:00 UTC) to pick up base-image and Alpine package updates, which also refreshes the `-` tag of the current commit; pin by digest (`@sha256:…`) for a byte-for-byte fixed image. The amd64 image of every variant is booted and checked (PHP version, extensions, non-root, healthy and serving PHP for the frankenphp images) before it gets any tag, so a build that doesn't start never replaces `-latest`; the check is `.github/scripts/smoke-test.sh`. The arm64 images are built and published but not booted. The frankenphp images stay on their pinned FrankenPHP version, so a new FrankenPHP release (and the PHP version it ships) still needs `FRANKENPHP_VERSION` bumped in their Dockerfiles. +Tags follow `-` (e.g. `8.4-frankenphp-wordpress`), each also published as `-latest` and as `-` for the commit it was built from. Every image is rebuilt weekly (Mondays 10:00 UTC) to pick up base-image and Alpine package updates, which also refreshes the `-` tag of the current commit; pin by digest (`@sha256:…`) for a byte-for-byte fixed image. Both the amd64 and arm64 images of every variant are booted and checked (PHP version, extensions, architecture, non-root, healthy and serving PHP for the frankenphp images) before they get any tag, so a build that doesn't start on either architecture never replaces `-latest`; the check is `.github/scripts/smoke-test.sh`. The arm64 frankenphp images are checked on a native arm64 runner, the arm64 cli images under QEMU. The frankenphp images stay on their pinned FrankenPHP version, so a new FrankenPHP release (and the PHP version it ships) still needs `FRANKENPHP_VERSION` bumped in their Dockerfiles. ```sh docker pull ghcr.io/aliasproject/php:8.4-frankenphp From b6d0ffa829b885403645f5afbdd8a630477b6727 Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Thu, 26 Nov 2026 09:23:18 -0700 Subject: [PATCH 2/3] Smoke test: report a failed pull, and bound the QEMU step - A failed --platform pre-pull was silenced, so a registry error showed up later as a wrong-architecture failure. It now fails the check, unless the image exists locally (a local build that was never pushed). - The extra docker run arguments were an array, which bash before 4.4 (macOS) treats as unset under set -u when empty, breaking hand runs there. A small drun wrapper replaces it. - The QEMU arm64 cli step gets a 10-minute timeout, so a hung emulated run fails quickly instead of at the 6-hour job limit. Refs ALI-1113 --- .github/scripts/smoke-test.sh | 45 ++++++++++++++++++---------- .github/workflows/build-and-push.yml | 3 ++ 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index 4eb839e..381fc8f 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -28,12 +28,11 @@ image=$2 php_version=$3 platform=${4:-} -platform_args=() expected_arch= case "$platform" in "") ;; - linux/amd64) platform_args=(--platform "$platform"); expected_arch=x86_64 ;; - linux/arm64) platform_args=(--platform "$platform"); expected_arch=aarch64 ;; + linux/amd64) expected_arch=x86_64 ;; + linux/arm64) expected_arch=aarch64 ;; *) echo "unknown platform: $platform (expected linux/amd64 or linux/arm64)" >&2; exit 2 ;; esac @@ -48,13 +47,29 @@ esac fail() { echo "SMOKE TEST FAILED ($variant, $image${platform:+, $platform}): $*" >&2; exit 1; } +# docker run, with --platform when a platform was given. A function rather +# than an array of extra arguments: bash before 4.4 (macOS's /bin/bash) treats +# an empty array as unset under set -u. +drun() { + if [ -n "$platform" ]; then + docker run --platform "$platform" "$@" + else + docker run "$@" + fi +} + # With a platform, pull that platform's image first. Without this, a docker # engine that keeps one image per name (the classic image store) can find the # other architecture's image, pulled for an earlier run of this script, under -# the same name. The check_arch below would then fail. A pull that fails (an -# image that only exists locally, say) is left to docker run to report. +# the same name. The check_arch below would then fail. A failed pull is fatal +# unless the image is already present locally (a locally built image that was +# never pushed, say). if [ -n "$platform" ]; then - docker pull --quiet --platform "$platform" "$image" >/dev/null 2>&1 || true + if ! docker pull --quiet --platform "$platform" "$image" >/dev/null; then + docker image inspect "$image" >/dev/null 2>&1 \ + || fail "could not pull the $platform image" + echo "pull failed; using the local image" >&2 + fi fi # uname -m inside the container ($1) against the requested platform. @@ -79,18 +94,18 @@ check_php() { } if [ "$variant" = cli ]; then - version=$(docker run --rm "${platform_args[@]}" "$image" php -r 'echo PHP_VERSION;') || fail "php did not run" - loaded=$(docker run --rm "${platform_args[@]}" "$image" php -m | tr '\n' ' ') || fail "php -m did not run" + version=$(drun --rm "$image" php -r 'echo PHP_VERSION;') || fail "php did not run" + loaded=$(drun --rm "$image" php -m | tr '\n' ' ') || fail "php -m did not run" check_php "$version" "$loaded" - uid=$(docker run --rm "${platform_args[@]}" "$image" id -u) || fail "id did not run" + uid=$(drun --rm "$image" id -u) || fail "id did not run" [ "$uid" != 0 ] || fail "runs as root" - arch=$(docker run --rm "${platform_args[@]}" "$image" uname -m) || fail "uname did not run" + arch=$(drun --rm "$image" uname -m) || fail "uname did not run" check_arch "$arch" # Only cli/Dockerfile.wordpress carries the WORDPRESS_VCS_CHECKOUT prepend # file (see the frankenphp checks below). CI doesn't build that image, so # this runs only by hand. A docker run that fails fails the check, rather # than reading as "no file". - has_vcs=$(docker run --rm "${platform_args[@]}" "$image" sh -c \ + has_vcs=$(drun --rm "$image" sh -c \ 'if test -f /usr/local/share/php-prepend/wordpress-vcs-checkout.php; then echo yes; else echo no; fi') \ || fail "the WORDPRESS_VCS_CHECKOUT file check did not run" case "$has_vcs" in @@ -100,9 +115,9 @@ if [ "$variant" = cli ]; then if [ "$has_vcs" = yes ]; then seeded='{"automatic_updates_is_vcs_checkout":{"10":[{"function":"__return_true","accepted_args":1}]}}' check='echo " /tmp/vcs.php && php /tmp/vcs.php' - out=$(docker run --rm "${platform_args[@]}" "$image" sh -c "$check") || fail "vcs check did not run" + out=$(drun --rm "$image" sh -c "$check") || fail "vcs check did not run" [ "$out" = none ] || fail "WORDPRESS_VCS_CHECKOUT unset, but the filter was seeded: $out" - out=$(docker run --rm "${platform_args[@]}" -e WORDPRESS_VCS_CHECKOUT=1 "$image" sh -c "$check") || fail "vcs check did not run" + out=$(drun --rm -e WORDPRESS_VCS_CHECKOUT=1 "$image" sh -c "$check") || fail "vcs check did not run" [ "$out" = "$seeded" ] || fail "WORDPRESS_VCS_CHECKOUT=1 did not seed the filter: $out" fi echo "ok: $image (PHP $version, uid $uid, $arch)" @@ -150,9 +165,9 @@ boot() { containers+=("$cname") # Short health interval: the image's own HEALTHCHECK (30s) would make the # wait below much longer than it needs to be. - docker run -d --name "$cname" -p 127.0.0.1::80 -v "$fixture:/app:ro" \ + drun -d --name "$cname" -p 127.0.0.1::80 -v "$fixture:/app:ro" \ --health-interval 2s --health-timeout 5s --health-retries 5 --health-start-period 30s \ - "${platform_args[@]}" "$@" "$image" >/dev/null + "$@" "$image" >/dev/null for _ in $(seq 1 60); do state=$(docker inspect -f '{{.State.Status}}' "$cname") diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index e9e63cb..e12db26 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -156,8 +156,11 @@ jobs: # cli checks are a handful of short `docker run`s with no server or # timeouts, far lighter than the emulated extension compile the build # step has already survived. + # The timeout turns a hung emulated run into a failure in minutes + # rather than at the 6-hour job limit. - name: Smoke test ${{ matrix.name }} (arm64, QEMU) if: ${{ steps.build.outcome == 'success' && contains(matrix.platforms, 'arm64') }} + timeout-minutes: 10 run: | tag="${{ matrix.tag }}" .github/scripts/smoke-test.sh cli \ From 5aa4fb0cd531486ddac33918c39eb71d0595aabc Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Thu, 26 Nov 2026 09:26:06 -0700 Subject: [PATCH 3/3] Smoke test: no local fallback for a digest reference A digest always names a registry image, and in CI the local copy under that name is the other architecture's (the amd64 check pulled it), so a failed arm64 pull fell back to it and reported a wrong architecture instead of the pull error. Refs ALI-1113 --- .github/scripts/smoke-test.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index 381fc8f..e208d50 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -63,9 +63,13 @@ drun() { # other architecture's image, pulled for an earlier run of this script, under # the same name. The check_arch below would then fail. A failed pull is fatal # unless the image is already present locally (a locally built image that was -# never pushed, say). +# never pushed, say). A digest reference always comes from a registry, and the +# local copy may be the other architecture's, so its pull must succeed. if [ -n "$platform" ]; then if ! docker pull --quiet --platform "$platform" "$image" >/dev/null; then + case "$image" in + *@sha256:*) fail "could not pull the $platform image" ;; + esac docker image inspect "$image" >/dev/null 2>&1 \ || fail "could not pull the $platform image" echo "pull failed; using the local image" >&2