feat: remote-build shim via sand-boxer (SAND-WP-0012)
Delegate make remote-build to sandboxer create when CLI is available; retain legacy rsync path with deprecation notice. Add verify script.
This commit is contained in:
@@ -15,11 +15,37 @@ sync:
|
||||
--exclude='*.o' --exclude='*.hi' \
|
||||
$(PROJECT)/ $(VM):$(RDIR)/
|
||||
|
||||
# Run cabal build on VM after sync
|
||||
# Run cabal build on VM — prefers sand-boxer workspace (SAND-WP-0012 shim)
|
||||
.PHONY: remote-build
|
||||
remote-build: sync
|
||||
remote-build:
|
||||
@if command -v sandboxer >/dev/null 2>&1; then \
|
||||
$(MAKE) remote-build-sandboxer; \
|
||||
else \
|
||||
echo "WARN: sandboxer not on PATH — using legacy rsync-only path" >&2; \
|
||||
$(MAKE) remote-build-legacy; \
|
||||
fi
|
||||
|
||||
# Legacy rsync + ssh (deprecated — install sand-boxer for isolated workspaces)
|
||||
.PHONY: remote-build-legacy
|
||||
remote-build-legacy: sync
|
||||
ssh $(VM) "cd $(RDIR) && source ~/.ghcup/env && cabal build all 2>&1"
|
||||
|
||||
.PHONY: remote-build-sandboxer
|
||||
remote-build-sandboxer:
|
||||
@set -euo pipefail; \
|
||||
STATUS=$$(sandboxer create \
|
||||
--profile profile.vm-haskell-build \
|
||||
--input vm=$(VM) \
|
||||
--input repo=$(PROJECT) \
|
||||
--actor agt \
|
||||
--project the-custodian \
|
||||
--host localhost); \
|
||||
ID=$$(echo "$$STATUS" | python3 -c "import sys,json; print(json.load(sys.stdin)['sandbox_id'])"); \
|
||||
RDIR=$$(echo "$$STATUS" | python3 -c "import sys,json; r=json.load(sys.stdin).get('reachability') or {}; print(r.get('remote_dir',''))"); \
|
||||
test -n "$$RDIR"; \
|
||||
ssh $(VM) "cd $$RDIR && source ~/.ghcup/env && cabal build all 2>&1"; \
|
||||
sandboxer destroy "$$ID"
|
||||
|
||||
# Run tests on VM
|
||||
.PHONY: remote-test
|
||||
remote-test: sync
|
||||
|
||||
@@ -75,7 +75,7 @@ ssh haskell-build # should connect via tunnel
|
||||
## Using the VM
|
||||
|
||||
```bash
|
||||
# Build a Haskell project remotely
|
||||
# Build a Haskell project remotely (prefers sand-boxer workspace when installed)
|
||||
make remote-build PROJECT=~/projects/my-app
|
||||
|
||||
# Run tests
|
||||
|
||||
Reference in New Issue
Block a user