fix: run-builder.sh uses BUILDER_USER from .env, not hardcoded
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
BUILDER_HOST=
|
BUILDER_HOST=
|
||||||
|
BUILDER_USER=
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# run-builder.sh — trigger debug ISO build on remote Alpine builder VM
|
# run-builder.sh — trigger ISO build on remote Debian 12 builder VM
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# sh scripts/run-builder.sh
|
# sh scripts/run-builder.sh
|
||||||
@@ -18,10 +18,15 @@ if [ -f "$ENV_FILE" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
BUILDER_HOST="${BUILDER_HOST:-}"
|
BUILDER_HOST="${BUILDER_HOST:-}"
|
||||||
|
BUILDER_USER="${BUILDER_USER:-}"
|
||||||
if [ -z "$BUILDER_HOST" ]; then
|
if [ -z "$BUILDER_HOST" ]; then
|
||||||
echo "ERROR: BUILDER_HOST not set. Copy .env.example to .env and set the address."
|
echo "ERROR: BUILDER_HOST not set. Copy .env.example to .env and set the address."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$BUILDER_USER" ]; then
|
||||||
|
echo "ERROR: BUILDER_USER not set. Set it in .env."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
EXTRA_ARGS=""
|
EXTRA_ARGS=""
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
@@ -32,7 +37,7 @@ while [ $# -gt 0 ]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "=== bee builder ==="
|
echo "=== bee builder ==="
|
||||||
echo "Builder: ${BUILDER_HOST}"
|
echo "Builder: ${BUILDER_USER}@${BUILDER_HOST}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# --- check local repo is in sync with remote ---
|
# --- check local repo is in sync with remote ---
|
||||||
@@ -53,10 +58,10 @@ fi
|
|||||||
echo "repo: in sync with remote ($LOCAL)"
|
echo "repo: in sync with remote ($LOCAL)"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
ssh -o StrictHostKeyChecking=no root@"${BUILDER_HOST}" /bin/sh <<ENDSSH
|
ssh -o StrictHostKeyChecking=no "${BUILDER_USER}@${BUILDER_HOST}" /bin/sh <<ENDSSH
|
||||||
set -e
|
set -e
|
||||||
REPO=/root/bee
|
REPO="/home/${BUILDER_USER}/bee"
|
||||||
LOG=/var/log/bee-build.log
|
LOG=/tmp/bee-build.log
|
||||||
|
|
||||||
if [ ! -d "\$REPO/.git" ]; then
|
if [ ! -d "\$REPO/.git" ]; then
|
||||||
echo "--- cloning bee repo ---"
|
echo "--- cloning bee repo ---"
|
||||||
@@ -67,24 +72,25 @@ cd "\$REPO"
|
|||||||
echo "--- pulling latest ---"
|
echo "--- pulling latest ---"
|
||||||
git checkout -- .
|
git checkout -- .
|
||||||
git pull --ff-only
|
git pull --ff-only
|
||||||
chmod +x iso/overlay/etc/init.d/* iso/overlay/usr/local/bin/* 2>/dev/null || true
|
chmod +x iso/overlay/usr/local/bin/* 2>/dev/null || true
|
||||||
|
|
||||||
# Kill any previous build session
|
# Kill any previous build session
|
||||||
screen -S bee-build -X quit 2>/dev/null || true
|
screen -S bee-build -X quit 2>/dev/null || true
|
||||||
|
|
||||||
echo "--- starting build in screen session (survives SSH disconnect) ---"
|
echo "--- starting build in screen session (survives SSH disconnect) ---"
|
||||||
echo "--- log: \$LOG ---"
|
echo "--- log: \$LOG ---"
|
||||||
screen -dmS bee-build sh -c "sh iso/builder/build.sh ${EXTRA_ARGS} > \$LOG 2>&1; echo \$? > /tmp/bee-build-exit"
|
screen -dmS bee-build sh -c "sudo sh iso/builder/build.sh ${EXTRA_ARGS} > \$LOG 2>&1; echo \$? > /tmp/bee-build-exit"
|
||||||
|
|
||||||
# Stream log until build finishes
|
# Stream log until build finishes
|
||||||
echo "--- streaming build log (Ctrl+C safe — build continues on VM) ---"
|
echo "--- streaming build log (Ctrl+C safe — build continues on VM) ---"
|
||||||
while screen -list | grep -q bee-build; do
|
tail -n +1 -f "\$LOG" 2>/dev/null &
|
||||||
tail -n +1 -f "\$LOG" 2>/dev/null & TAIL_PID=\$!
|
TAIL_PID=\$!
|
||||||
sleep 1
|
while screen -list 2>/dev/null | grep -q bee-build; do
|
||||||
while screen -list | grep -q bee-build; do sleep 2; done
|
sleep 2
|
||||||
kill \$TAIL_PID 2>/dev/null || true
|
|
||||||
break
|
|
||||||
done
|
done
|
||||||
|
sleep 1
|
||||||
|
kill \$TAIL_PID 2>/dev/null || true
|
||||||
|
|
||||||
tail -n 20 "\$LOG" 2>/dev/null || true
|
tail -n 20 "\$LOG" 2>/dev/null || true
|
||||||
|
|
||||||
EXIT_CODE=\$(cat /tmp/bee-build-exit 2>/dev/null || echo 1)
|
EXIT_CODE=\$(cat /tmp/bee-build-exit 2>/dev/null || echo 1)
|
||||||
@@ -95,14 +101,14 @@ echo ""
|
|||||||
echo "=== downloading ISO ==="
|
echo "=== downloading ISO ==="
|
||||||
LOCAL_ISO_DIR="${REPO_ROOT}/iso/out"
|
LOCAL_ISO_DIR="${REPO_ROOT}/iso/out"
|
||||||
mkdir -p "${LOCAL_ISO_DIR}"
|
mkdir -p "${LOCAL_ISO_DIR}"
|
||||||
if command -v rsync >/dev/null 2>&1 && ssh -o StrictHostKeyChecking=no root@"${BUILDER_HOST}" command -v rsync >/dev/null 2>&1; then
|
if command -v rsync >/dev/null 2>&1 && ssh -o StrictHostKeyChecking=no "${BUILDER_USER}@${BUILDER_HOST}" command -v rsync >/dev/null 2>&1; then
|
||||||
rsync -az --progress \
|
rsync -az --progress \
|
||||||
-e "ssh -o StrictHostKeyChecking=no" \
|
-e "ssh -o StrictHostKeyChecking=no" \
|
||||||
"root@${BUILDER_HOST}:/root/bee/dist/*.iso" \
|
"${BUILDER_USER}@${BUILDER_HOST}:/home/${BUILDER_USER}/bee/dist/*.iso" \
|
||||||
"${LOCAL_ISO_DIR}/"
|
"${LOCAL_ISO_DIR}/"
|
||||||
else
|
else
|
||||||
scp -o StrictHostKeyChecking=no \
|
scp -o StrictHostKeyChecking=no \
|
||||||
"root@${BUILDER_HOST}:/root/bee/dist/*.iso" \
|
"${BUILDER_USER}@${BUILDER_HOST}:/home/${BUILDER_USER}/bee/dist/*.iso" \
|
||||||
"${LOCAL_ISO_DIR}/"
|
"${LOCAL_ISO_DIR}/"
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user