fix labels v2 - simpler approach
This commit is contained in:
@@ -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 ==="
|
||||
'
|
||||
Reference in New Issue
Block a user