fix: check local/remote sync before building to prevent building stale code

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 22:44:22 +03:00
parent fd071e28db
commit eecd0799a0

View File

@@ -35,6 +35,24 @@ echo "=== bee builder ==="
echo "Builder: ${BUILDER_HOST}"
echo ""
# --- check local repo is in sync with remote ---
cd "${REPO_ROOT}"
git fetch --quiet origin main
LOCAL=$(git rev-parse HEAD)
REMOTE=$(git rev-parse origin/main)
if [ "$LOCAL" != "$REMOTE" ]; then
echo "ERROR: local repo is not in sync with remote."
echo " local: $LOCAL"
echo " remote: $REMOTE"
echo ""
echo "Push or pull before building:"
echo " git push — if you have unpushed commits"
echo " git pull — if remote is ahead"
exit 1
fi
echo "repo: in sync with remote ($LOCAL)"
echo ""
ssh -o StrictHostKeyChecking=no root@"${BUILDER_HOST}" /bin/sh <<ENDSSH
set -e
REPO=/root/bee