mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-12 09:33:23 +00:00
Stop the firewall and ACL suites rebuilding an image their caller supplied
Both suites ran `docker compose up -d --build` unconditionally, and their compose files carry both a build context and an image name, so the flag rebuilt and retagged the shared test image from the shared build context on every run. Their --skip-build flag did not cover it: it guarded only the Rust build above. Under a harness that has already built the image and handed it over, that rebuild can only replace the binaries under test with whatever the shared context currently holds. The nat scripts had the mirror-image problem. Their image guard built a replacement whenever the image was missing, which is right by hand and wrong under a harness: when the caller names an image it built, a miss means something upstream is broken, and manufacturing a substitute hides that. They now fail loudly in that case and keep building only on the hand path. The mesh-lab guard reads the same variable and its build hint moves to the script that still produces the shared tag.
This commit is contained in:
@@ -262,10 +262,21 @@ dump_lan_diagnostics() {
|
||||
trap 'echo ""; echo "NAT test interrupted"; cleanup; exit 130' INT TERM
|
||||
|
||||
require_test_image() {
|
||||
if ! docker image inspect fips-test:latest >/dev/null 2>&1; then
|
||||
echo "fips-test:latest not found; building test image"
|
||||
"$BUILD_SCRIPT"
|
||||
local img="${FIPS_TEST_IMAGE:-fips-test:latest}"
|
||||
if docker image inspect "$img" >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
# Building here is right for a hand run and wrong under a harness. When
|
||||
# FIPS_TEST_IMAGE is set the caller has already built the image it named, so
|
||||
# a miss means something upstream is broken; building a substitute would
|
||||
# hide that and run binaries nobody asked for.
|
||||
if [ -n "${FIPS_TEST_IMAGE:-}" ]; then
|
||||
echo "ERROR: $img not present, and FIPS_TEST_IMAGE names the caller's own image" >&2
|
||||
echo "The harness that set it is expected to have built it." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "$img not found; building test image"
|
||||
"$BUILD_SCRIPT"
|
||||
}
|
||||
|
||||
require_docker_daemon() {
|
||||
|
||||
@@ -49,10 +49,21 @@ require_docker_daemon() {
|
||||
}
|
||||
|
||||
require_test_image() {
|
||||
if ! docker image inspect fips-test:latest >/dev/null 2>&1; then
|
||||
echo "fips-test:latest not found; building test image"
|
||||
"$BUILD_SCRIPT"
|
||||
local img="${FIPS_TEST_IMAGE:-fips-test:latest}"
|
||||
if docker image inspect "$img" >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
# Building here is right for a hand run and wrong under a harness. When
|
||||
# FIPS_TEST_IMAGE is set the caller has already built the image it named, so
|
||||
# a miss means something upstream is broken; building a substitute would
|
||||
# hide that and run binaries nobody asked for.
|
||||
if [ -n "${FIPS_TEST_IMAGE:-}" ]; then
|
||||
echo "ERROR: $img not present, and FIPS_TEST_IMAGE names the caller's own image" >&2
|
||||
echo "The harness that set it is expected to have built it." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "$img not found; building test image"
|
||||
"$BUILD_SCRIPT"
|
||||
}
|
||||
|
||||
dump_diagnostics() {
|
||||
|
||||
@@ -60,10 +60,21 @@ require_docker_daemon() {
|
||||
}
|
||||
|
||||
require_test_image() {
|
||||
if ! docker image inspect fips-test:latest >/dev/null 2>&1; then
|
||||
echo "fips-test:latest not found; building test image"
|
||||
"$BUILD_SCRIPT"
|
||||
local img="${FIPS_TEST_IMAGE:-fips-test:latest}"
|
||||
if docker image inspect "$img" >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
# Building here is right for a hand run and wrong under a harness. When
|
||||
# FIPS_TEST_IMAGE is set the caller has already built the image it named, so
|
||||
# a miss means something upstream is broken; building a substitute would
|
||||
# hide that and run binaries nobody asked for.
|
||||
if [ -n "${FIPS_TEST_IMAGE:-}" ]; then
|
||||
echo "ERROR: $img not present, and FIPS_TEST_IMAGE names the caller's own image" >&2
|
||||
echo "The harness that set it is expected to have built it." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "$img not found; building test image"
|
||||
"$BUILD_SCRIPT"
|
||||
}
|
||||
|
||||
dump_diagnostics() {
|
||||
|
||||
Reference in New Issue
Block a user