An open-source, faster Devin alternative
TypeScript
retry, module insertion (#114)
Brian Reardon037fea49c891
diff --git a/.github/workflows/deploy-worker.yml b/.github/workflows/deploy-worker.ymlindex 4d569d87..727768d0 100644--- a/.github/workflows/deploy-worker.yml+++ b/.github/workflows/deploy-worker.yml@@ -76,9 +76,20 @@ jobs:API_KEY=$(grep OPENSANDBOX_API_KEY /etc/opensandbox/server.env | cut -d= -f2-)- # Get all worker private IPs from the control plane API- WORKER_IPS=$(curl -sf -H "X-API-Key: $API_KEY" http://localhost:8080/api/workers \- | jq -r ".[].http_addr" | sed "s|http://||;s|:.*||")+ # Get all worker private IPs from the control plane API (retry if server is briefly unavailable)+ WORKER_IPS=""+ set +e+ for attempt in 1 2 3 4 5; do+ WORKER_IPS=$(curl -sf -H "X-API-Key: $API_KEY" http://localhost:8080/api/workers \+ | jq -r ".[].http_addr" | sed "s|http://||;s|:.*||")+ if [ $? -eq 0 ] && [ -n "$WORKER_IPS" ]; then+ break+ fi+ echo "Control plane not ready (attempt $attempt/5), retrying in 5s..."+ sudo systemctl status opensandbox-server --no-pager -l 2>/dev/null | tail -5 || true+ sleep 5+ done+ set -eif [ -z "$WORKER_IPS" ]; thenecho "ERROR: No workers found"@@ -119,6 +130,35 @@ jobs:sudo rm -f \"\$IMAGES_DIR/default.ext4\"sudo bash deploy/ec2/build-rootfs-docker.sh /usr/local/bin/osb-agent \"\$IMAGES_DIR\" default+ # Patch rootfs with kernel modules for virtio-mem support+ GUEST_KVER=\"\"+ if [ -f /opt/opensandbox/guest-kernel-version ]; then+ GUEST_KVER=\$(cat /opt/opensandbox/guest-kernel-version)+ elif ls -d /lib/modules/*-generic >/dev/null 2>&1; then+ GUEST_KVER=\$(ls -d /lib/modules/*-generic | sort -V | tail -1 | xargs basename)+ fi+ if [ -n \"\$GUEST_KVER\" ] && [ -d \"/lib/modules/\$GUEST_KVER\" ]; then+ echo \"Patching rootfs with kernel modules for \$GUEST_KVER...\"+ MNTDIR=\$(mktemp -d)+ sudo mount -o loop \"\$IMAGES_DIR/default.ext4\" \"\$MNTDIR\"+ sudo rm -rf \"\$MNTDIR/lib/modules\"/*+ sudo cp -a \"/lib/modules/\$GUEST_KVER\" \"\$MNTDIR/lib/modules/\"+ sudo depmod -b \"\$MNTDIR\" \"\$GUEST_KVER\" 2>/dev/null || true+ # Create insmod symlink (busybox applet) if missing+ if [ -f \"\$MNTDIR/bin/busybox\" ] && [ ! -e \"\$MNTDIR/sbin/insmod\" ]; then+ sudo ln -sf /bin/busybox \"\$MNTDIR/sbin/insmod\"+ fi+ # Create modprobe symlink if missing+ if [ -f \"\$MNTDIR/bin/busybox\" ] && [ ! -e \"\$MNTDIR/sbin/modprobe\" ]; then+ sudo ln -sf /bin/busybox \"\$MNTDIR/sbin/modprobe\"+ fi+ sudo umount \"\$MNTDIR\"+ rmdir \"\$MNTDIR\"+ echo \"Rootfs patched with kernel modules for \$GUEST_KVER\"+ else+ echo \"WARNING: No guest kernel modules found for virtio-mem\"+ fi+# Delete golden snapshot so it rebuilds with new agentDATA_DIR=\$(grep OPENSANDBOX_DATA_DIR /etc/opensandbox/worker.env 2>/dev/null | cut -d= -f2- || echo '/data/sandboxes')sudo rm -rf \"\${DATA_DIR}/golden\" 2>/dev/null || true