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:
@@ -35,6 +35,24 @@ echo "=== bee builder ==="
|
|||||||
echo "Builder: ${BUILDER_HOST}"
|
echo "Builder: ${BUILDER_HOST}"
|
||||||
echo ""
|
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
|
ssh -o StrictHostKeyChecking=no root@"${BUILDER_HOST}" /bin/sh <<ENDSSH
|
||||||
set -e
|
set -e
|
||||||
REPO=/root/bee
|
REPO=/root/bee
|
||||||
|
|||||||
Reference in New Issue
Block a user