2828# `openshell` CLI with the embedded runtime.
2929# 3. On macOS, codesigns the VM driver (libkrun needs the
3030# `com.apple.security.hypervisor` entitlement).
31- # 4. Starts the gateway with `-- drivers vm --disable-tls
32- # --disable- gateway-auth --db-url sqlite: <run-state>/gateway.db` on a random
33- # free port, waits for `Server listening`, then runs the selected
34- # Rust e2e test (`smoke` by default).
31+ # 4. Writes a per-run gateway config with `[openshell. drivers.vm]`
32+ # settings, starts the gateway with `--config <run-state>/gateway.toml`
33+ # on a random free port, waits for `Server listening`, then runs the
34+ # selected Rust e2e test (`smoke` by default).
3535# 5. Tears the gateway down and (on failure) preserves the gateway
3636# log and every VM serial console log for post-mortem.
3737#
@@ -50,7 +50,7 @@ DRIVER_BIN="${ROOT}/target/debug/openshell-driver-vm"
5050E2E_TEST=" ${OPENSHELL_E2E_VM_TEST:- smoke} "
5151E2E_FEATURES=" ${OPENSHELL_E2E_VM_FEATURES:- e2e-vm} "
5252
53- # The VM driver places `compute-driver.sock` under --vm-driver-state-dir .
53+ # The VM driver places `compute-driver.sock` under `[openshell.drivers.vm].state_dir` .
5454# AF_UNIX SUN_LEN is 104 bytes on macOS (108 on Linux), so paths anchored
5555# in the workspace's `target/` blow the limit on typical developer
5656# machines — e.g. a ~100-char `~/.superset/worktrees/.../target/...`
@@ -68,6 +68,11 @@ SANDBOX_PROVISION_TIMEOUT=180
6868
6969# ── Build prerequisites ──────────────────────────────────────────────
7070
71+ if [ -n " ${RUSTC_WRAPPER:- } " ] && [ " ${OPENSHELL_E2E_VM_ALLOW_RUSTC_WRAPPER:- 0} " != " 1" ]; then
72+ echo " ==> Building without RUSTC_WRAPPER=${RUSTC_WRAPPER} (set OPENSHELL_E2E_VM_ALLOW_RUSTC_WRAPPER=1 to keep it)"
73+ unset RUSTC_WRAPPER
74+ fi
75+
7176mkdir -p " ${COMPRESSED_DIR} "
7277
7378if ! find " ${COMPRESSED_DIR} " -maxdepth 1 -name ' libkrun*.zst' | grep -q . ; then
@@ -116,6 +121,7 @@ mkdir -p "${RUN_STATE_DIR}"
116121GATEWAY_LOG=" $( mktemp /tmp/openshell-gateway-e2e.XXXXXX) "
117122GATEWAY_PID_FILE=" ${RUN_STATE_DIR} /gateway.pid"
118123GATEWAY_ARGS_FILE=" ${RUN_STATE_DIR} /gateway.args"
124+ GATEWAY_CONFIG=" ${RUN_STATE_DIR} /gateway.toml"
119125GATEWAY_DB=" ${RUN_STATE_DIR} /gateway.db"
120126
121127# ── Cleanup (trap) ───────────────────────────────────────────────────
@@ -172,28 +178,36 @@ trap cleanup EXIT
172178
173179echo " ==> Starting openshell-gateway on 127.0.0.1:${HOST_PORT} (state: ${RUN_STATE_DIR} )"
174180
175- # Pin --driver-dir to the workspace `target/debug/` so we always pick up
181+ # Pin `driver_dir` to the workspace `target/debug/` so we always pick up
176182# the driver we just cargo-built. Without this, the gateway's
177183# `resolve_compute_driver_bin` fallback prefers
178184# `~/.local/libexec/openshell/openshell-driver-vm` when present,
179185# which silently shadows development builds — a subtle source of
180186# stale-binary bugs in e2e runs.
181- # --grpc-endpoint is the URL the VM driver passes into each guest as
187+ # `grpc_endpoint` is the URL the VM driver passes into each guest as
182188# OPENSHELL_ENDPOINT. The supervisor inside the VM dials this address.
183- # Use `host.containers.internal` rather than `127.0.0.1` so gvproxy's
184- # host-loopback proxy carries the connection — gvproxy's bare gateway IP
185- # (192.168.127.1) does NOT forward arbitrary host ports. The driver also
186- # rewrites loopback URLs to this hostname as a safety net, so this matches
187- # what the guest will actually see and aligns with `tasks/scripts/gateway-vm.sh`.
189+ # Use `host.openshell.internal` rather than `127.0.0.1` so gvproxy's
190+ # host-loopback proxy carries the connection while keeping the endpoint aligned
191+ # with package-managed gateway certificates. gvproxy's bare gateway IP
192+ # (192.168.127.1) does NOT forward arbitrary host ports.
193+ cat > " ${GATEWAY_CONFIG} " << EOF
194+ [openshell]
195+ version = 1
196+
197+ [openshell.gateway]
198+ bind_address = "127.0.0.1:${HOST_PORT} "
199+ compute_drivers = ["vm"]
200+ disable_tls = true
201+
202+ [openshell.drivers.vm]
203+ grpc_endpoint = "http://host.openshell.internal:${HOST_PORT} "
204+ driver_dir = "${ROOT} /target/debug"
205+ state_dir = "${RUN_STATE_DIR} "
206+ EOF
207+
188208GATEWAY_ARGS=(
189- --drivers vm
190- --disable-tls
191- --disable-gateway-auth
209+ --config " ${GATEWAY_CONFIG} "
192210 --db-url " sqlite:${GATEWAY_DB} ?mode=rwc"
193- --port " ${HOST_PORT} "
194- --grpc-endpoint " http://host.containers.internal:${HOST_PORT} "
195- --driver-dir " ${ROOT} /target/debug"
196- --vm-driver-state-dir " ${RUN_STATE_DIR} "
197211)
198212e2e_write_gateway_args_file " ${GATEWAY_ARGS_FILE} " " ${GATEWAY_ARGS[@]} "
199213
0 commit comments