From d3945d7234ad88e849085712dc5255400b1fd97e Mon Sep 17 00:00:00 2001 From: windychen Date: Thu, 6 Aug 2026 11:24:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20runner=20=E7=BB=B4=E6=8A=A4=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E7=A1=AC=E7=BC=96=E7=A0=81=20HTTPS=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/runner-maintenance.yaml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/runner-maintenance.yaml b/.gitea/workflows/runner-maintenance.yaml index 612cb76..be4dbaf 100644 --- a/.gitea/workflows/runner-maintenance.yaml +++ b/.gitea/workflows/runner-maintenance.yaml @@ -5,10 +5,6 @@ on: - cron: "0 */6 * * *" workflow_dispatch: -env: - GITEA_URL: https://gitea.windychen00n.work - VERDACCIO_URL: http://172.172.2.4:4873 - jobs: health-check: runs-on: docker @@ -26,28 +22,29 @@ jobs: - name: Check Gitea health id: gitea run: | - if curl -sf "$GITEA_URL/api/healthz" | grep -q '"status":"pass"'; then + if curl -sf --connect-timeout 10 "https://gitea.windychen00n.work/api/healthz" | grep -q '"status":"pass"'; then echo "result=ok|Gitea 健康检查通过" >> $GITHUB_OUTPUT else echo "result=fail|Gitea 健康检查失败" >> $GITHUB_OUTPUT + curl -sv --connect-timeout 10 "https://gitea.windychen00n.work/api/healthz" 2>&1 | tail -5 || true exit 1 fi - name: Check Verdaccio health id: verdaccio run: | - if curl -sf "$VERDACCIO_URL/-/ping" >/dev/null 2>&1; then + if curl -sf --connect-timeout 5 "http://172.172.2.4:4873/-/ping" >/dev/null 2>&1; then echo "result=ok|Verdaccio 正常" >> $GITHUB_OUTPUT else - echo "result=fail|Verdaccio 不可达" >> $GITHUB_OUTPUT + echo "result=fail|Verdaccio 不可达(job 容器可能不在内网)" >> $GITHUB_OUTPUT exit 1 fi - name: Check runner registration id: runner run: | - RESP=$(curl -sf -u "${{ secrets.CI_USER }}:${{ secrets.CI_PASSWORD }}" \ - "$GITEA_URL/api/v1/admin/actions/runners") + RESP=$(curl -sf --connect-timeout 10 -u "${{ secrets.CI_USER }}:${{ secrets.CI_PASSWORD }}" \ + "https://gitea.windychen00n.work/api/v1/admin/actions/runners") ONLINE=$(echo "$RESP" | grep -c '"status":"online"' || true) if [ "${ONLINE:-0}" -ge 1 ]; then NAME=$(echo "$RESP" | grep -o '"name":"[^"]*"' | head -1 | cut -d'"' -f4)