2026-09-08 23:33:59 -04:00
|
|
|
#!/bin/sh
|
2026-09-12 13:47:56 -04:00
|
|
|
# When a remote harness shares a workspace volume, seed it from the deploy
|
|
|
|
|
# snapshot baked into the image (/app/repo).
|
2026-09-12 17:27:17 -04:00
|
|
|
set -u
|
|
|
|
|
|
2026-09-12 13:47:56 -04:00
|
|
|
session_type="${WORKER_SESSION_TYPE:-minimal}"
|
|
|
|
|
if [ "$session_type" = "openhands" ] || [ "$session_type" = "opencode" ]; then
|
|
|
|
|
if [ "$session_type" = "opencode" ]; then
|
|
|
|
|
target="${WORKER_OPENCODE_WORKSPACE:-/workspace/repo}"
|
|
|
|
|
else
|
|
|
|
|
target="${WORKER_OPENHANDS_WORKSPACE:-/workspace/repo}"
|
|
|
|
|
fi
|
2026-09-08 23:33:59 -04:00
|
|
|
if [ ! -f "$target/pnpm-workspace.yaml" ]; then
|
2026-09-12 13:47:56 -04:00
|
|
|
echo "[worker-entrypoint] seeding ${session_type} workspace at ${target}"
|
2026-09-12 17:27:17 -04:00
|
|
|
mkdir -p "$target" || true
|
|
|
|
|
# Volume may be root-owned from an earlier helper container — best-effort seed.
|
|
|
|
|
if ! cp -a /app/repo/. "$target/" 2>/tmp/worker-seed.err; then
|
|
|
|
|
echo "[worker-entrypoint] WARN: workspace seed failed (continuing with /app/repo):"
|
|
|
|
|
cat /tmp/worker-seed.err 2>/dev/null || true
|
|
|
|
|
fi
|
2026-09-08 23:33:59 -04:00
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
cd /app/apps/worker
|
|
|
|
|
exec node dist/index.js
|