fix: harden embedded Pi lifecycle recovery

This commit is contained in:
2026-08-04 23:14:47 +02:00
parent a368889838
commit 935bb1db0e
15 changed files with 572 additions and 101 deletions
+8 -2
View File
@@ -4,12 +4,18 @@ set -euo pipefail
repository_root=$(cd "$(dirname "$0")/.." && pwd)
dockerfile="$repository_root/docker/thothctl.Dockerfile"
builder_image=$(awk '$1 == "FROM" && $3 == "AS" && $4 == "build" { print $2; exit }' "$dockerfile")
expected_builder='golang:1.26.5-bookworm@sha256:1ecb7edf62a0408027bd5729dfd6b1b8766e578e8df93995b225dfd0944eb651'
if [[ ! "$builder_image" =~ ^golang:1\.24@sha256:[0-9a-f]{64}$ ]]; then
echo "thothctl builder must use a readable golang:1.24 tag with an immutable digest" >&2
if [[ "$builder_image" != "$expected_builder" ]]; then
echo "thothctl builder must pin golang:1.26.5-bookworm by the approved multi-platform digest" >&2
exit 1
fi
grep -qx 'go 1.26.0' "$repository_root/tools/thothctl/go.mod"
grep -qx 'toolchain go1.26.5' "$repository_root/tools/thothctl/go.mod"
grep -Eq '^[[:space:]]*github.com/sirupsen/logrus v1\.9\.1$' "$repository_root/tools/thothctl/go.mod"
grep -Eq '^[[:space:]]*golang.org/x/sys v0\.47\.0$' "$repository_root/tools/thothctl/go.mod"
manifest=$(docker buildx imagetools inspect "$builder_image")
printf '%s\n' "$manifest" | grep -Eq 'Platform:[[:space:]]+linux/amd64'
printf '%s\n' "$manifest" | grep -Eq 'Platform:[[:space:]]+linux/arm64'