From 468cf69d60ccc0ce390793667a59ff2ff1faec85 Mon Sep 17 00:00:00 2001 From: windychen Date: Thu, 6 Aug 2026 11:22:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20runner=20=E7=BB=B4=E6=8A=A4=20workfl?= =?UTF-8?q?ow=20=E4=BD=BF=E7=94=A8=E9=BB=98=E8=AE=A4=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E5=B9=B6=E5=8A=A8=E6=80=81=E5=AE=89=E8=A3=85=20curl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/runner-maintenance.yaml | 26 ++++++++---------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/.gitea/workflows/runner-maintenance.yaml b/.gitea/workflows/runner-maintenance.yaml index 39ad12f..eeb3fef 100644 --- a/.gitea/workflows/runner-maintenance.yaml +++ b/.gitea/workflows/runner-maintenance.yaml @@ -8,11 +8,16 @@ on: jobs: health-check: runs-on: docker - container: - image: alpine:3.20 steps: - name: Install tools - run: apk add --no-cache curl docker-cli grep + run: | + if command -v apk >/dev/null 2>&1; then + apk add --no-cache curl grep + elif command -v apt-get >/dev/null 2>&1; then + apt-get update -qq && apt-get install -y -qq curl grep + else + echo "No supported package manager"; exit 1 + fi - name: Check Gitea health id: gitea @@ -48,22 +53,9 @@ jobs: exit 1 fi - - name: Cleanup stale action containers - id: cleanup - run: | - REMOVED=0 - for cid in $(docker ps -a --filter "label=org.opencontainers.image.source=gitea/act_runner" -q 2>/dev/null || true); do - STATE=$(docker inspect -f '{{.State.Status}}' "$cid" 2>/dev/null || echo unknown) - if [ "$STATE" = "exited" ]; then - docker rm "$cid" >/dev/null 2>&1 && REMOVED=$((REMOVED+1)) || true - fi - done - echo "result=ok|清理 ${REMOVED} 个已退出的 job 容器" >> $GITHUB_OUTPUT - continue-on-error: true - - name: Notify DingTalk on failure if: failure() run: | curl -s -X POST "https://oapi.dingtalk.com/robot/send?access_token=${{ secrets.DINGDING_TOKEN }}" \ -H "Content-Type: application/json" \ - -d '{"msgtype":"markdown","markdown":{"title":"❌ Gitea Runner 自主维护告警 chen-fnos","text":"## ❌ Gitea Runner 自主维护告警 chen-fnos\n\n- Gitea: ${{ steps.gitea.outputs.result }}\n- Verdaccio: ${{ steps.verdaccio.outputs.result }}\n- Runner: ${{ steps.runner.outputs.result }}\n- 清理: ${{ steps.cleanup.outputs.result }}\n\n请检查 gitea-runner 容器状态"}}' + -d '{"msgtype":"markdown","markdown":{"title":"❌ Gitea Runner 自主维护告警 chen-fnos","text":"## ❌ Gitea Runner 自主维护告警 chen-fnos\n\n- Gitea: ${{ steps.gitea.outputs.result }}\n- Verdaccio: ${{ steps.verdaccio.outputs.result }}\n- Runner: ${{ steps.runner.outputs.result }}\n\n请检查 gitea-runner 容器状态"}}'