fix labels v2 - simpler approach

This commit is contained in:
2026-07-13 17:38:27 +08:00
parent 189d29cd6a
commit e13f4e153a
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
# 直接一行命令,不用heredoc,确保输出能捕获
docker run --rm --privileged --pid=host alpine nsenter -t 1 -m -u -n -i sh -c '
echo "=== DB EXISTS? ==="
ls -la /var/lib/gitea/data/gitea.db
echo "=== RUNNER COUNT ==="
sqlite3 /var/lib/gitea/data/gitea.db "SELECT count(*) FROM action_runner;"
echo "=== CURRENT LABELS ==="
sqlite3 /var/lib/gitea/data/gitea.db "SELECT id, name, agent_labels FROM action_runner WHERE status=0 ORDER BY id;"
echo "=== ADDING LABEL ==="
sqlite3 /var/lib/gitea/data/gitea.db "
UPDATE action_runner
SET agent_labels = json_insert(agent_labels, '\$[#]', 'ubuntu-22.04')
WHERE status = 0;
"
echo "Update done, rows affected: $?"
echo "=== VERIFY ==="
sqlite3 /var/lib/gitea/data/gitea.db "SELECT id, name, agent_labels FROM action_runner WHERE status=0 ORDER BY id;"
echo "=== DONE ==="
'