ci: fix runner-3 with host label
Add Unique Tag / add-tag (push) Successful in 0s
Fix Simple / fix (push) Failing after 1s
Fix Final / fix (push) Failing after 1s
Diag SaaS Runner / diag (push) Failing after 1s
Runner Diagnose / diag (push) Failing after 1s
Runner Diagnose / diagnose (push) Successful in 0s
Fix Runner 3 / fix (push) Successful in 23s

This commit is contained in:
灵应
2026-07-12 02:31:22 +08:00
parent c6c840cc6e
commit ab0e6d6c8e
+18 -16
View File
@@ -6,9 +6,9 @@ on:
jobs:
fix:
runs-on: runtime-builder
runs-on: host
steps:
- name: fix r3
- name: fix runner-3
run: |
set -ex
CI_DIR="/var/lib/xiaoxia-ci"
@@ -17,28 +17,30 @@ jobs:
LABELS="saas,runtime-builder,host,ubuntu-latest"
TOKEN="1f8058d097e3942a9ed31c44382baf7f08311272"
echo "=== runner-3 status ==="
systemctl status act_runner-3.service 2>&1 | head -15 || true
# Only run on build server
test -f "$ACT_BIN" || exit 0
echo ""
echo "=== runner-3 .runner file ==="
ls -la "$CI_DIR/runner-3/" || true
cat "$CI_DIR/runner-3/.runner" 2>/dev/null | head -5 || echo "no .runner file"
echo ""
echo "=== Re-registering runner-3 ==="
REG_TOKEN=$(curl -sk -X POST -H "Authorization: token $TOKEN" "$GITEA_URL/api/v1/repos/xiaoxia/xiaoxia-saas/actions/runners/registration-token" | python3 -c "import sys,json; print(json.load(sys.stdin).get('token',''))")
echo "token len: ${#REG_TOKEN}"
test -n "$REG_TOKEN"
systemctl stop act_runner-3.service 2>&1 || true
sleep 2
echo "Stopping runner-3..."
systemctl stop act_runner-3.service
sleep 3
echo "Registering runner-3..."
cd "$CI_DIR/runner-3"
rm -f .runner
$ACT_BIN register --instance "$GITEA_URL" --token "$REG_TOKEN" --name "xiaoxia-ci-runner-3" --labels "$LABELS" --no-interactive
echo "Starting runner-3..."
systemctl start act_runner-3.service
sleep 15
sleep 20
echo ""
echo "=== Final ==="
echo "=== Result ==="
curl -sk -H "Authorization: token $TOKEN" "$GITEA_URL/api/v1/repos/xiaoxia/xiaoxia-saas/actions/runners?limit=50" > /tmp/r.json
python3 -c "import sys,json;d=json.load(open('/tmp/r.json'));online=[r for r in d['runners'] if r['status']=='online'];print(f'online: {len(online)}');[print(f' {r[\"name\"]}: {[l[\"name\"] for l in r[\"labels\"]]}') for r in online]"
echo "DONE"