fix(scripts): correct platform dir path + add ROOT isolation (shellcheck clean)

- dev-start.sh: $ROOT/platform → $ROOT/workspace-server (Go server
  lives in workspace-server/, not platform/; any developer running
  this script would get "no such directory" immediately)
- nuke-and-rebuild.sh: add ROOT variable and -f "$ROOT/docker-compose.yml"
  so docker compose works from any CWD; fix post-rebuild-setup.sh path
- rollback-latest.sh: add 'local' to src_digest and new_digest vars
  inside roll() function to prevent global-scope leakage

Co-authored-by: Molecule AI Core-DevOps <core-devops@agents.moleculesai.app>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
molecule-ai[bot] 2026-04-22 15:42:24 +00:00 committed by GitHub
parent 66ea0b6471
commit 4a03b89e91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 6 deletions

View File

@ -36,7 +36,7 @@ done
echo " Postgres ready."
echo "==> Starting Platform (Go :8080)..."
cd "$ROOT/platform"
cd "$ROOT/workspace-server"
go run ./cmd/server &
PLATFORM_PID=$!

View File

@ -3,16 +3,17 @@
# Usage: bash scripts/nuke-and-rebuild.sh
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
echo "=== NUKE ==="
docker compose down -v 2>/dev/null || true
docker compose -f "$ROOT/docker-compose.yml" down -v 2>/dev/null || true
docker ps -a --format "{{.Names}}" | grep "^ws-" | xargs -r docker rm -f 2>/dev/null || true
docker volume ls --format "{{.Name}}" | grep "^ws-" | xargs -r docker volume rm 2>/dev/null || true
docker network rm molecule-monorepo-net 2>/dev/null || true
echo " cleaned"
echo "=== REBUILD ==="
docker compose up -d --build
docker compose -f "$ROOT/docker-compose.yml" up -d --build
echo " platform + canvas up"
echo "=== POST-REBUILD SETUP ==="
bash scripts/post-rebuild-setup.sh
bash "$ROOT/scripts/post-rebuild-setup.sh"

View File

@ -59,10 +59,10 @@ roll() {
echo " FAIL: $src not found in registry. Did you type the wrong sha?" >&2
return 1
fi
src_digest=$(crane digest "$src")
local src_digest=$(crane digest "$src")
crane tag "$src" latest
new_digest=$(crane digest "$dst")
local new_digest=$(crane digest "$dst")
if [ "$new_digest" != "$src_digest" ]; then
echo " FAIL: $dst digest $new_digest does not match expected $src_digest" >&2