ci: multi-arch-safe php.net guard and emergency workflow (no platform change)

- scripts/image-label-amd64.sh: index-safe read of the amd64 image's labels
  (OCI index with attestations, Docker manifest list, single manifest).
- scripts/php-emergency-guard.sh: used by both build-push.yaml guard sites;
  same decisions as the old inline step on single-platform images, but FAILS
  CLOSED when the labels cannot be read (only "tag not found" passes).
- lsphp-source-emergency.yaml: push by digest + assemble (copy of HMB
  assemble-multiarch-index.sh); optional arm64; refuses to replace a
  multi-arch production tag with amd64-only unless allow_amd64_only.
- Tests wired into Shell-Checks; main build matrix platforms unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXjXyosSkunDsdWz3mb
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-11 17:22:24 -08:00
1 parent 4b35869477
commit 8a6a6d7b44
8 files changed
+565 -24

No files matched your search

+21 -18
View File
@@ -59,12 +59,23 @@ jobs:
scripts/tests/lsphp-info-probe.test.sh \
scripts/lsphp-repo-version.sh \
scripts/tests/lsphp-repo-version.test.sh \
scripts/image-label-amd64.sh \
scripts/php-emergency-guard.sh \
scripts/index-platforms.sh \
scripts/assemble-multiarch-index.sh \
scripts/tests/image-label-amd64.test.sh \
scripts/tests/index-platforms.test.sh \
scripts/tests/lsphp-abi-gate.test.sh \
.gitea/scripts/resolve-base-image.sh
- name: lsphp repo-version lookup test
run: ./scripts/tests/lsphp-repo-version.test.sh
- name: multi-arch guard tests (index-safe label read, fail-closed, assemble rules)
run: |
./scripts/tests/image-label-amd64.test.sh
./scripts/tests/index-platforms.test.sh
- name: lsphp probe regression test
run: ./scripts/tests/lsphp-info-probe.test.sh
@@ -445,7 +456,10 @@ jobs:
# :phpNN points at right now. While LiteSpeed still lags, a normal build
# would silently put the VULNERABLE packaged lsphp back. Refuse instead;
# the job goes green again by itself once the LiteSpeed repo catches up.
# Fail-open if the tag cannot be inspected (first build, registry blip).
# Reads the labels of the linux/amd64 image behind the tag (index-safe:
# works for single-platform and multi-arch tags) and FAILS CLOSED if they
# cannot be read; only a tag that does not exist yet (first build) passes
# unchecked. scripts/php-emergency-guard.sh, tests in scripts/tests/.
- name: Do not roll back a newer php.net emergency image
env:
PHPVER: ${{ matrix.phpver }}
@@ -453,14 +467,7 @@ jobs:
run: |
set -euo pipefail
ref="repo.anhonesthost.net/cloud-hosting-platform/cac-litespeed:php${PHPVER}"
src=$(docker buildx imagetools inspect "$ref" --format '{{ index .Image.Config.Labels "org.whp.lsphp-source" }}' 2>/dev/null || true)
cur=$(docker buildx imagetools inspect "$ref" --format '{{ index .Image.Config.Labels "org.whp.php-version" }}' 2>/dev/null || true)
new="$NEW_PHP"
echo "published $ref: source=${src:-?} php=${cur:-?}; this build: packaged $new"
if [ "$src" = "php.net" ] && [ "$cur" != "$new" ] && [ "$(printf '%s\n%s\n' "$cur" "$new" | sort -V | tail -n1)" = "$cur" ]; then
echo "::error::$ref is a php.net emergency build of PHP $cur; LiteSpeed still ships $new. Not overwriting it with an older PHP. Re-run lsphp-source-emergency.yaml for a newer fix, or wait for LiteSpeed."
exit 1
fi
./scripts/php-emergency-guard.sh "$ref" "$NEW_PHP"
- name: Build and Push LiteSpeed Image
uses: docker/build-push-action@v6
@@ -605,7 +612,10 @@ jobs:
# :phpNN points at right now. While LiteSpeed still lags, a normal build
# would silently put the VULNERABLE packaged lsphp back. Refuse instead;
# the job goes green again by itself once the LiteSpeed repo catches up.
# Fail-open if the tag cannot be inspected (first build, registry blip).
# Reads the labels of the linux/amd64 image behind the tag (index-safe:
# works for single-platform and multi-arch tags) and FAILS CLOSED if they
# cannot be read; only a tag that does not exist yet (first build) passes
# unchecked. scripts/php-emergency-guard.sh, tests in scripts/tests/.
- name: Do not roll back a newer php.net emergency image
env:
PHPVER: ${{ matrix.phpver }}
@@ -613,14 +623,7 @@ jobs:
run: |
set -euo pipefail
ref="repo.anhonesthost.net/cloud-hosting-platform/cac-lsphp:php${PHPVER}"
src=$(docker buildx imagetools inspect "$ref" --format '{{ index .Image.Config.Labels "org.whp.lsphp-source" }}' 2>/dev/null || true)
cur=$(docker buildx imagetools inspect "$ref" --format '{{ index .Image.Config.Labels "org.whp.php-version" }}' 2>/dev/null || true)
new="$NEW_PHP"
echo "published $ref: source=${src:-?} php=${cur:-?}; this build: packaged $new"
if [ "$src" = "php.net" ] && [ "$cur" != "$new" ] && [ "$(printf '%s\n%s\n' "$cur" "$new" | sort -V | tail -n1)" = "$cur" ]; then
echo "::error::$ref is a php.net emergency build of PHP $cur; LiteSpeed still ships $new. Not overwriting it with an older PHP. Re-run lsphp-source-emergency.yaml for a newer fix, or wait for LiteSpeed."
exit 1
fi
./scripts/php-emergency-guard.sh "$ref" "$NEW_PHP"
- name: Build and Push lsphp Image
uses: docker/build-push-action@v6