ci: remove debug workflow - fix-simple.yml
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
name: Fix Simple
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- ci/runner-fix
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
fix:
|
||||
runs-on: saas
|
||||
steps:
|
||||
- name: fix
|
||||
run: |
|
||||
set -ex
|
||||
CI_DIR="/var/lib/xiaoxia-ci"
|
||||
ACT_BIN="$CI_DIR/act_runner"
|
||||
GITEA_URL="https://git.xiaoxiajianji.com"
|
||||
LABELS="saas,runtime-builder,host,ubuntu-latest"
|
||||
TOKEN="1f8058d097e3942a9ed31c44382baf7f08311272"
|
||||
|
||||
# Get token
|
||||
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}"
|
||||
|
||||
# Fix main runner
|
||||
systemctl stop act_runner.service
|
||||
sleep 2
|
||||
cd "$CI_DIR"
|
||||
rm -f .runner
|
||||
$ACT_BIN register --instance "$GITEA_URL" --token "$REG_TOKEN" --name "xiaoxia-ci-runner" --labels "$LABELS" --no-interactive
|
||||
sed -i 's|daemon.*|daemon -c /var/lib/xiaoxia-ci/.runner|' /etc/systemd/system/act_runner.service
|
||||
systemctl daemon-reload
|
||||
systemctl start act_runner.service
|
||||
echo "main runner done"
|
||||
|
||||
# Fix runner-3
|
||||
systemctl stop act_runner-3.service
|
||||
sleep 2
|
||||
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
|
||||
systemctl start act_runner-3.service
|
||||
echo "runner-3 done"
|
||||
|
||||
# Fix runner-2 (self) via restart
|
||||
cd "$CI_DIR/runner-2"
|
||||
rm -f .runner.new
|
||||
$ACT_BIN register --instance "$GITEA_URL" --token "$REG_TOKEN" --name "xiaoxia-ci-runner-2" --labels "$LABELS" --no-interactive --config /tmp/runner2-new.runner
|
||||
cp /tmp/runner2-new.runner "$CI_DIR/runner-2/.runner.pending"
|
||||
echo "runner-2 config prepared"
|
||||
|
||||
# Verify
|
||||
sleep 15
|
||||
curl -sk -H "Authorization: token $TOKEN" "$GITEA_URL/api/v1/repos/xiaoxia/xiaoxia-saas/actions/runners?limit=50" | python3 -c "import sys,json;d=json.load(sys.stdin);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]"
|
||||
|
||||
# Restart runner-2 in background
|
||||
nohup bash -c "sleep 10 && cp /var/lib/xiaoxia-ci/runner-2/.runner.pending /var/lib/xiaoxia-ci/runner-2/.runner && systemctl restart act_runner-2.service" > /dev/null 2>&1 &
|
||||
echo "runner-2 restart scheduled"
|
||||
echo "DONE"
|
||||
Reference in New Issue
Block a user