Skip to content

Commit 31a5e26

Browse files
committed
chore(isolation): move VM packaging to driver layer
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
1 parent 1e19a98 commit 31a5e26

2 files changed

Lines changed: 4 additions & 50 deletions

File tree

‎e2e/rust/e2e-vm.sh‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ if [ -z "${OPENSHELL_VM_DRIVER_BIN:-}" ]; then
8686
mise run vm:setup
8787
fi
8888

89-
# Always rebuild the guest bundle so an e2e run cannot silently exercise a
90-
# stale boundary binary after supervisor or isolation-interface changes.
91-
echo "==> Building bundled VM supervisor (mise run vm:supervisor)"
92-
mise run vm:supervisor
89+
if [ ! -f "${COMPRESSED_DIR}/openshell-sandbox.zst" ]; then
90+
echo "==> Building bundled VM supervisor (mise run vm:supervisor)"
91+
mise run vm:supervisor
92+
fi
9393

9494
export OPENSHELL_VM_RUNTIME_COMPRESSED_DIR="${OPENSHELL_VM_RUNTIME_COMPRESSED_DIR:-${COMPRESSED_DIR}}"
9595
else

‎tasks/scripts/vm/build-supervisor-bundle.sh‎

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ esac
6060

6161
SUPERVISOR_BIN="${ROOT}/target/${RUST_TARGET}/release/openshell-sandbox"
6262
SUPERVISOR_OUTPUT="${OUTPUT_DIR}/openshell-sandbox.zst"
63-
SUPERVISOR_RUNTIME_OUTPUT="${OUTPUT_DIR}/openshell-runtime.tar.zst"
6463

6564
echo "==> Building openshell-sandbox supervisor bundle"
6665
echo " Guest arch: ${GUEST_ARCH}"
@@ -124,51 +123,6 @@ fi
124123

125124
zstd -19 -T0 -f "${SUPERVISOR_BIN}" -o "${SUPERVISOR_OUTPUT}"
126125

127-
case "${GUEST_ARCH}" in
128-
aarch64|arm64) DOCKER_ARCH="arm64" ;;
129-
x86_64|amd64) DOCKER_ARCH="amd64" ;;
130-
esac
131-
132-
echo "==> Building trusted supervisor helper runtime"
133-
STAGED_SUPERVISOR="${ROOT}/deploy/docker/.build/prebuilt-binaries/${DOCKER_ARCH}/openshell-sandbox"
134-
RUNTIME_IMAGE="openshell-vm-helper-runtime:${DOCKER_ARCH}-$$"
135-
mkdir -p "$(dirname "${STAGED_SUPERVISOR}")"
136-
cp "${SUPERVISOR_BIN}" "${STAGED_SUPERVISOR}"
137-
138-
case "$(uname -m)" in
139-
aarch64|arm64) HOST_DOCKER_ARCH="arm64" ;;
140-
x86_64|amd64) HOST_DOCKER_ARCH="amd64" ;;
141-
*) HOST_DOCKER_ARCH="" ;;
142-
esac
143-
144-
if [ "${HOST_DOCKER_ARCH}" = "${DOCKER_ARCH}" ]; then
145-
docker build \
146-
--build-arg "TARGETARCH=${DOCKER_ARCH}" \
147-
--file "${ROOT}/deploy/docker/Dockerfile.supervisor" \
148-
--tag "${RUNTIME_IMAGE}" \
149-
"${ROOT}"
150-
else
151-
docker buildx build \
152-
--load \
153-
--platform "linux/${DOCKER_ARCH}" \
154-
--build-arg "TARGETARCH=${DOCKER_ARCH}" \
155-
--file "${ROOT}/deploy/docker/Dockerfile.supervisor" \
156-
--tag "${RUNTIME_IMAGE}" \
157-
"${ROOT}"
158-
fi
159-
160-
RUNTIME_CONTAINER="$(docker create "${RUNTIME_IMAGE}")"
161-
cleanup_runtime_image() {
162-
docker rm -f "${RUNTIME_CONTAINER}" >/dev/null 2>&1 || true
163-
docker image rm "${RUNTIME_IMAGE}" >/dev/null 2>&1 || true
164-
}
165-
trap cleanup_runtime_image EXIT
166-
docker cp "${RUNTIME_CONTAINER}:/openshell-runtime" - \
167-
| zstd -19 -T0 -f -o "${SUPERVISOR_RUNTIME_OUTPUT}"
168-
cleanup_runtime_image
169-
trap - EXIT
170-
171126
echo "==> Bundled supervisor ready"
172127
echo " Binary: $(du -sh "${SUPERVISOR_BIN}" | cut -f1)"
173128
echo " Compressed: $(du -sh "${SUPERVISOR_OUTPUT}" | cut -f1)"
174-
echo " Helper runtime: $(du -sh "${SUPERVISOR_RUNTIME_OUTPUT}" | cut -f1)"

0 commit comments

Comments
 (0)