feat(complement): Load test image archives

This commit is contained in:
Erwan Leboucher authored and Ellis Git committed 2026-09-11 14:48:35 +00:00
1 parent e48fe5bc4b
commit 749c3f58d0
2 files changed
+40 -7

No files matched your search

+38 -4
View File
@@ -7,10 +7,30 @@ DEFAULT_COMPLEMENT_SRC="$toplevel/target/complement"
DEFAULT_COMPLEMENT_REVISION="6d2fdc286c2b44faaddd1037205869b2242a4005"
MSC="${COMPLEMENT_MSC:-}"
if [ "${1:-}" = "--msc" ]; then
MSC="${2:-}"
shift 2
fi
IMAGE_ARCHIVE=""
while [ "$#" -gt 0 ]; do
case "$1" in
--msc)
if [ "$#" -lt 2 ]; then
echo "--msc requires an MSC number"
exit 2
fi
MSC="$2"
shift 2
;;
--image)
if [ "$#" -lt 2 ]; then
echo "--image requires a path to a Docker image archive"
exit 2
fi
IMAGE_ARCHIVE="$2"
shift 2
;;
*)
break
;;
esac
done
if [ -n "$MSC" ]; then
MSC="${MSC#MSC}"
@@ -63,6 +83,20 @@ for command in docker go jq; do
fi
done
if [ -n "$IMAGE_ARCHIVE" ]; then
if [ ! -f "$IMAGE_ARCHIVE" ]; then
echo "Docker image archive not found: $IMAGE_ARCHIVE"
exit 1
fi
load_output="$(docker load --input "$IMAGE_ARCHIVE" 2>&1)"
printf '%s\n' "$load_output"
COMPLEMENT_BASE_IMAGE="$(printf '%s\n' "$load_output" | sed -n 's/^Loaded image: //p; s/^Loaded image ID: //p' | tail -n1)"
if [ -z "$COMPLEMENT_BASE_IMAGE" ]; then
echo "could not determine the image loaded from: $IMAGE_ARCHIVE"
exit 1
fi
fi
if ! docker image inspect "$COMPLEMENT_BASE_IMAGE" > /dev/null 2>&1; then
echo "Complement base image not found: $COMPLEMENT_BASE_IMAGE"
echo "Build it with: cargo build -p conduwuit && docker build -t $COMPLEMENT_BASE_IMAGE -f docker/complement.Dockerfile ."