Files
seaweedfs/seaweed-block/scripts/refuse-lab-binary.sh
T
pingqiuandClaude Opus 5.5 549524f537 lab tag: a lab binary names itself and no image can hold one
A lab build's revision carries LAB BUILD(swblock_lab_bigvol), so -version and
the volume's /status show it. Every image Dockerfile runs
scripts/refuse-lab-binary.sh right after its go build: a binary that is a
lab build, or cannot answer -version, stops the image build, so neither
the publish workflow nor the image scripts can push one. lab-tag-check.sh
now fails closed: an allowlist of the files that may name the tag (git grep;
a scan that cannot run fails), plus the wiring (each Dockerfile refuses
after its last build; the publish workflow builds only from those, with no
go build of its own). Controls cover each contamination and the refusal
script's stand-in binaries. The lab headroom test asserts the warning, and
both invariant rows name the lab exception.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 06:22:45 -08:00

18 lines
898 B
Bash

#!/usr/bin/env bash
# refuse-lab-binary.sh BIN...: refuse to publish a lab build. Each BIN must
# answer -version, and its answer must not carry the lab marker
# (internal/buildinfo LabMarker, set by the swblock_lab_bigvol tag). A binary
# that cannot answer is refused too (fail closed). Run by every image
# Dockerfile right after its go build, so no image holding a lab binary is
# built, and so none is pushed.
set -euo pipefail
[ "$#" -gt 0 ] || { echo "refuse-lab-binary: no binary given" >&2; exit 2; }
for bin in "$@"; do
out=$("$bin" -version 2>&1) || { echo "refuse-lab-binary: $bin -version failed: $out" >&2; exit 1; }
[ -n "$out" ] || { echo "refuse-lab-binary: $bin -version printed nothing" >&2; exit 1; }
case "$out" in
*"LAB BUILD"*) echo "refuse-lab-binary: $bin is a lab build ($out); not published" >&2; exit 1 ;;
esac
echo "refuse-lab-binary: $bin ok: $out"
done