|
|
|
@@ -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.
|
|
|
|
|