feat(cd): 发布结果上报 ci-bridge
build / build (push) Successful in 2m23s

This commit is contained in:
姚章浩
2026-11-25 17:38:05 +08:00
parent 7801c163e4
commit b59ec66387
2 changed files with 129 additions and 0 deletions
+36
View File
@@ -80,3 +80,39 @@ jobs:
KG_CD_SSH_HOST: ${{ vars.KG_CD_SSH_HOST }}
KG_CD_SSH_PORT: ${{ vars.KG_CD_SSH_PORT }}
run: python3 scripts/production_cd.py send --event "$GITHUB_EVENT_PATH"
notify:
needs: [guard, publish]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: 取同一提交的上报脚本
run: |
set -eu
test "$GITHUB_EVENT_NAME" = workflow_dispatch
test "$GITHUB_REPOSITORY" = Weknora/knowledge-governance
test "$GITHUB_REF" = refs/heads/main
git init -q .
git fetch -q --depth 200 "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" refs/heads/main
git checkout -q --detach "$GITHUB_SHA"
test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
- name: 上报 ci-bridge(发布结果,通知失败不改变发布结论)
if: always()
env:
BRIDGE_URL: ${{ vars.CI_BRIDGE_URL }}
BRIDGE_TOKEN: ${{ secrets.CI_BRIDGE_TOKEN }}
CI_PUBLIC_BASE_URL: https://gitea.zheromiku.top
GUARD_RESULT: ${{ needs.guard.result }}
PUBLISH_RESULT: ${{ needs.publish.result }}
DEPLOY_SHA: ${{ inputs.sha }}
DEPLOY_BUNDLE: ${{ inputs.bundle }}
DEPLOY_TASK: ${{ inputs.task }}
run: |
set +e; set +o pipefail
B="${BRIDGE_URL:-}"
for cand in "$B" "http://172.17.0.1:8899" "http://192.168.50.134:8899" "http://100.92.49.78:8899"; do
if [ -n "$cand" ]; then curl -s -m 5 -o /dev/null "$cand/healthz" && { B="$cand"; break; }; fi
done
echo "使用 ci-bridge: ${B:-(不可达)}"
CI_BRIDGE_RESOLVED="$B" python3 scripts/cd_notify.py
echo "上报结束(通知失败不改变发布结论)"