diff --git a/.github/drone.yml b/.github/drone.yml index 0e3e83e62..a20d5ef12 100644 --- a/.github/drone.yml +++ b/.github/drone.yml @@ -306,6 +306,64 @@ steps: event: - tag + - name: notify-release-failure + image: curlimages/curl:8.10.1 + pull: if-not-exists + environment: + FEISHU_DEPLOY_WEBHOOK: + from_secret: FEISHU_DEPLOY_WEBHOOK + commands: + - | + set -eu + PAYLOAD="$( + printf \ + '{"msg_type":"text","content":{"text":"❌ Clawith 发布失败\\n版本:%s\\n构建:%s\\n提交:%.8s"}}' \ + "$DRONE_TAG" "$DRONE_BUILD_LINK" "$DRONE_COMMIT" + )" + RESPONSE="$( + curl --fail-with-body --silent --show-error \ + --header 'Content-Type: application/json' \ + --data "$PAYLOAD" \ + "$FEISHU_DEPLOY_WEBHOOK" + )" + echo "飞书通知响应: $RESPONSE" + printf '%s' "$RESPONSE" | + grep -Eq '"code"[[:space:]]*:[[:space:]]*0([,}])' + when: + event: + - tag + status: + - failure + + - name: notify-deployment-success + image: curlimages/curl:8.10.1 + pull: if-not-exists + environment: + FEISHU_DEPLOY_WEBHOOK: + from_secret: FEISHU_DEPLOY_WEBHOOK + commands: + - | + set -eu + PAYLOAD="$( + printf \ + '{"msg_type":"text","content":{"text":"✅ Clawith 部署成功\\n版本:%s\\n构建:%s\\n提交:%.8s"}}' \ + "$DRONE_TAG" "$DRONE_BUILD_LINK" "$DRONE_COMMIT" + )" + RESPONSE="$( + curl --fail-with-body --silent --show-error \ + --header 'Content-Type: application/json' \ + --data "$PAYLOAD" \ + "$FEISHU_DEPLOY_WEBHOOK" + )" + echo "飞书通知响应: $RESPONSE" + printf '%s' "$RESPONSE" | + grep -Eq '"code"[[:space:]]*:[[:space:]]*0([,}])' + when: + event: + - tag + status: + - success + - name: cleanup-ci-images image: docker:24.0.6 privileged: true diff --git a/deploy/RELEASE_DEPLOYMENT.md b/deploy/RELEASE_DEPLOYMENT.md index 4ce28ca55..ef13d2430 100644 --- a/deploy/RELEASE_DEPLOYMENT.md +++ b/deploy/RELEASE_DEPLOYMENT.md @@ -16,7 +16,8 @@ owns CI validation, artifact transfer, and production deployment. - validate upgrading from the previous stable release; - export and transfer the target images; - load the images and recreate the production application services; - - verify the proxied API health endpoint. + - verify the proxied API health endpoint; + - send a Feishu notification when the release succeeds or fails. 5. GitHub Actions publishes the GitHub Release and finishes without waiting for Drone. Drone continues the deployment asynchronously and reports its status on the tagged commit. @@ -36,6 +37,7 @@ Configure these Drone repository secrets: | `PROXY` | Optional HTTP/HTTPS proxy used during clone and image builds | | `PRIVATE_SERVER_IP` | Production server hostname or IP address | | `sshpwd` | Password for the production deployment user | +| `FEISHU_DEPLOY_WEBHOOK` | Feishu custom bot webhook for successful deployment notifications | The deployment currently connects as `qinrui` on port `10022` and writes release artifacts to `/home/qinrui/clawith_new`. @@ -75,6 +77,13 @@ The remote deployment loads the transferred images and force-recreates only are not recreated. Deployment succeeds only after the frontend proxy returns an API health response whose status is `ok`. +Drone sends the release result, tag, build link, and short commit SHA to the +configured Feishu custom bot. The success message is sent only after the health +check passes. Any failure during a tag pipeline, including build, test, +transfer, restart, or health-check failures, sends a failure message. A +notification API error fails the Drone step so the missing notification is +visible. + If Drone fails, the GitHub tag and Release remain published for investigation. Fix or rerun the Drone build for that tag; do not move or reuse a published release tag.