From c376cacfa52d8c57c85ccdb7126061634ca3ee19 Mon Sep 17 00:00:00 2001 From: CI Bot Date: Mon, 13 Jul 2026 18:19:22 +0800 Subject: [PATCH] ops: check new server env after downgrade --- .gitea/workflows/check-new-server.yml | 15 +++++++++++++ scripts/check_new_server.py | 31 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .gitea/workflows/check-new-server.yml create mode 100644 scripts/check_new_server.py diff --git a/.gitea/workflows/check-new-server.yml b/.gitea/workflows/check-new-server.yml new file mode 100644 index 000000000..12b0a50a7 --- /dev/null +++ b/.gitea/workflows/check-new-server.yml @@ -0,0 +1,15 @@ +name: Check New Server Env + +on: + push: + branches: + - ops/downgrade-runners + +jobs: + check: + runs-on: saas + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Check new server + run: python3 scripts/check_new_server.py diff --git a/scripts/check_new_server.py b/scripts/check_new_server.py new file mode 100644 index 000000000..9975ac214 --- /dev/null +++ b/scripts/check_new_server.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +import subprocess, os + +NEW_SERVER = "172.30.18.199" +KEY_CONTENT = """-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACD6GquAk5vBEfbtaJCTSfnQEhjzC8e5GF60hSbPP0BJbAAAAJiQxGNokMRj +aAAAAAtzc2gtZWQyNTUxOQAAACD6GquAk5vBEfbtaJCTSfnQEhjzC8e5GF60hSbPP0BJbA +AAAED2muzuU4BAiCqbg0ayGxgiDvfS/xI1SFvb32oLzTnn8/oaq4CTm8ER9u1okJNJ+dAS +GPMLx7kYXrSFJs8/QElsAAAAFHJ1bm5lci1hZG1pbkB4aWFveGlhAQ== +-----END OPENSSH PRIVATE KEY----- +""" +key_path = "/tmp/new_server_ed25519" +with open(key_path, "w") as f: + f.write(KEY_CONTENT) +os.chmod(key_path, 0o600) + +def ssh(cmd): + r = subprocess.run(f'ssh -i {key_path} -o StrictHostKeyChecking=no root@{NEW_SERVER} "{cmd}"', + shell=True, capture_output=True, text=True) + return r.stdout.strip() + r.stderr.strip() + +print("=== 新服务器环境检查 ===") +print("OS:", ssh("cat /etc/os-release | head -5")) +print("Python版本:", ssh("python3 --version 2>&1")) +print("pip版本:", ssh("pip3 --version 2>&1")) +print("Docker版本:", ssh("docker --version 2>&1")) +print("Runner进程数:", ssh("ps aux | grep act_runner_v0.2.6 | grep -v grep | wc -l")) +print("Runner服务状态:") +print(ssh("for i in 1 2 3 4 5 6; do echo -n \" runner-$i: \"; systemctl is-active act-runner-$i.service; done")) +print("本地镜像:", ssh("docker images | head -10"))