arm64-attach: fix compiled-in defaults probe, allow known upload_progress default #58
No files matched your search
@@ -266,7 +266,7 @@ jobs:
|
||||
# OLS family: the arm64 (packaged lsphp / OLS from the LiteSpeed repo and base image) must be
|
||||
# observably the SAME PHP as the existing amd64 image (php.net-source or packaged): identical
|
||||
# PHP_VERSION, SAPI, loaded extensions + versions and EVERY ini value, both with the image's
|
||||
# config and with `-n` (compiled-in defaults). scripts/arm64-parity-probe.php runs natively on
|
||||
# config and with no ini at all (compiled-in defaults, one known exception). scripts/arm64-parity-probe.php runs natively on
|
||||
# amd64 and under QEMU (a throwaway BuildKit RUN) on arm64; any difference prints as a diff
|
||||
# and fails the run before the tag is touched. shared-ols runs no PHP: openlitespeed -v only.
|
||||
- name: "Parity - same PHP / OLS as the existing amd64 image"
|
||||
@@ -292,22 +292,35 @@ jobs:
|
||||
diff -u "$work/amd/ols.txt" "$work/out/ols.txt" || { echo "::error::openlitespeed version/modules differ between amd64 and arm64; not attaching"; exit 1; }
|
||||
[ "$IMAGE" != shared-ols ] || { echo "parity OK: OpenLiteSpeed version and modules identical (shared-ols runs no PHP)"; exit 0; }
|
||||
ls_bin="/usr/local/lsws/lsphp${PHPVER}/bin/lsphp"
|
||||
for mode in cfg n; do
|
||||
flag=""; [ "$mode" = n ] && flag="-n"
|
||||
# cfg = the image's own config (what customers get); def = compiled-in defaults only
|
||||
# (no php.ini, no scan dir). (`lsphp -n` is not usable: it only prints usage.)
|
||||
for mode in cfg def; do
|
||||
env_=""; flag=""; [ "$mode" = def ] && { env_="PHP_INI_SCAN_DIR=/nonexistent"; flag="-c /nonexistent"; }
|
||||
# probe piped over stdin (not a bind mount: the job's docker daemon cannot see the workspace)
|
||||
docker run --rm -i --platform linux/amd64 --entrypoint sh "$REPO@$AMD64" -c "cat > /tmp/probe.php; $ls_bin $flag /tmp/probe.php" < "$work/ctx/probe.php" > "$work/amd/$mode.txt"
|
||||
docker run --rm -i --platform linux/amd64 --entrypoint sh "$REPO@$AMD64" -c "cat > /tmp/probe.php; $env_ $ls_bin $flag /tmp/probe.php" < "$work/ctx/probe.php" > "$work/amd/$mode.txt"
|
||||
done
|
||||
# the same two runs on arm64, inside one BuildKit build (no binfmt for `docker run` here)
|
||||
printf 'FROM %s@%s AS src\nCOPY probe.php /probe.php\nRUN %s /probe.php > /cfg.txt && %s -n /probe.php > /n.txt\nFROM scratch\nCOPY --from=src /cfg.txt /n.txt /\n' "$REPO" "$ARM64_DIGEST" "$ls_bin" "$ls_bin" |
|
||||
printf 'FROM %s@%s AS src\nCOPY probe.php /probe.php\nRUN %s /probe.php > /cfg.txt && PHP_INI_SCAN_DIR=/nonexistent %s -c /nonexistent /probe.php > /def.txt\nFROM scratch\nCOPY --from=src /cfg.txt /def.txt /\n' "$REPO" "$ARM64_DIGEST" "$ls_bin" "$ls_bin" |
|
||||
docker buildx build --platform linux/arm64 --output "type=local,dest=$work/out" -f - "$work/ctx"
|
||||
rc=0
|
||||
for mode in cfg n; do
|
||||
for mode in cfg def; do
|
||||
echo "== $mode: $(head -1 "$work/amd/$mode.txt") (amd64) vs $(head -1 "$work/out/$mode.txt") (arm64); $(grep -c '^ext ' "$work/amd/$mode.txt") / $(grep -c '^ext ' "$work/out/$mode.txt") extensions, $(grep -c '^ini ' "$work/amd/$mode.txt") / $(grep -c '^ini ' "$work/out/$mode.txt") ini values"
|
||||
grep -q '^PHP_VERSION=[0-9]' "$work/amd/$mode.txt" || { echo "::error::cannot read the amd64 probe output ($mode)"; exit 1; }
|
||||
diff -u "$work/amd/$mode.txt" "$work/out/$mode.txt" || rc=1
|
||||
if [ "$mode" = cfg ]; then
|
||||
diff -u "$work/amd/$mode.txt" "$work/out/$mode.txt" || rc=1
|
||||
else
|
||||
# KNOWN, accepted difference (docs/arm64-ols-family.md): LiteSpeed's packaged arm64 lsphp is compiled with
|
||||
# session.upload_progress.enabled=0, its amd64 package (and our php.net-source amd64 image, which copies
|
||||
# it) with 1. Both images ship session.upload_progress.enabled=0 in their ini (zz-php2shell-mitigation.ini),
|
||||
# so the EFFECTIVE value (cfg mode, compared above with no exception) is identical. Any OTHER compiled-in
|
||||
# difference fails the run.
|
||||
known='^ini session\.upload_progress\.enabled='
|
||||
echo "known compiled-in difference (not a failure): amd64 $(grep "$known" "$work/amd/def.txt") / arm64 $(grep "$known" "$work/out/def.txt")"
|
||||
diff -u <(grep -v "$known" "$work/amd/def.txt") <(grep -v "$known" "$work/out/def.txt") || rc=1
|
||||
fi
|
||||
done
|
||||
[ "$rc" = 0 ] || { echo "::error::the new arm64 is not the same PHP as the existing amd64 image (diff above); not attaching. Rebuild amd64 or fix the arm64 build first."; exit 1; }
|
||||
echo "parity OK: version, SAPI, extensions and every ini value identical"
|
||||
echo "parity OK: version, SAPI, extensions and every effective ini value identical; compiled-in defaults identical apart from the known session.upload_progress.enabled"
|
||||
|
||||
# Re-creates the tag index: existing amd64 entries by digest + the new arm64. Aborts if the
|
||||
# tag moved since the plan; verifies the amd64 manifest digest is unchanged afterwards.
|
||||
|
||||
@@ -21,9 +21,22 @@ apt, noble arm64), not from source, because:
|
||||
* the result is checked, not assumed: the workflow runs `scripts/arm64-parity-probe.php` natively in
|
||||
the existing amd64 image and under QEMU in the new arm64 image and FAILS the run (tag untouched)
|
||||
on any difference in PHP_VERSION, SAPI, the loaded extension list and versions, or any of the
|
||||
~350 ini values (with the image's config and with `-n`). It also compares the OpenLiteSpeed
|
||||
~350 ini values, with the image's own config (what customers get) and with no ini at all
|
||||
(compiled-in defaults; one known exception below). It also compares the OpenLiteSpeed
|
||||
version and module versions (LiteSpeed's per-arch "BUILD built:" stamp is ignored).
|
||||
Measured 2026-11-20 on cac-lsphp:php85: 418 lines identical.
|
||||
Measured 2026-11-20 on cac-lsphp:php85: 62/62 extensions and 351/351 effective ini values identical.
|
||||
|
||||
### Known difference: compiled-in `session.upload_progress.enabled`
|
||||
|
||||
LiteSpeed's packaged arm64 lsphp is compiled with `session.upload_progress.enabled=0`; its amd64
|
||||
package reports `1`, and our php.net-source amd64 images copy that `1` on purpose
|
||||
(`lsphp-src-build.sh` step 2c). Both architectures ship `session.upload_progress.enabled = 0` in
|
||||
`zz-php2shell-mitigation.ini`, so the EFFECTIVE value is `0` on both (`php -i` in a running
|
||||
container, the `cfg` probe, which the gate compares with no exception). Only the compiled-in
|
||||
default (visible with no ini files, e.g. `PHP_INI_SCAN_DIR=/nonexistent lsphp -c /nonexistent`)
|
||||
differs, and the gate allows exactly that one directive. If identical compiled-in defaults are ever
|
||||
required, the arm64 image would have to be built from php.net source (the source path would need
|
||||
its step 2c to accept a packaged default of `0`; not done).
|
||||
|
||||
`EXPECT_LSPHP_PKG` / `EXPECT_PHP_VERSION` come from the arm64 repo index
|
||||
(`scripts/lsphp-repo-version.sh PHPVER arm64`), not the amd64 one.
|
||||
|
||||
Reference in new issue
Block a user