From ceacbea08a5296775e5a9251b90f55b44cb8a9ba Mon Sep 17 00:00:00 2001 From: yaojin3616 Date: Tue, 28 Jul 2026 22:05:29 +0800 Subject: [PATCH 1/2] Notify Feishu after successful deployment --- .github/drone.yml | 27 +++++++++++++++++++++++++++ deploy/RELEASE_DEPLOYMENT.md | 8 +++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/drone.yml b/.github/drone.yml index 0e3e83e62..a2f4e06b7 100644 --- a/.github/drone.yml +++ b/.github/drone.yml @@ -306,6 +306,33 @@ steps: event: - tag + - 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 + - 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..5ee866677 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 after deployment succeeds. 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,10 @@ 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`. +After the health check succeeds, Drone sends the deployed tag, build link, and +short commit SHA to the configured Feishu custom bot. 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. From bf04998485fa0a446a7114efadf4d79450f5a72d Mon Sep 17 00:00:00 2001 From: yaojin3616 Date: Tue, 28 Jul 2026 22:08:05 +0800 Subject: [PATCH 2/2] Notify Feishu when releases fail --- .github/drone.yml | 31 +++++++++++++++++++++++++++++++ deploy/RELEASE_DEPLOYMENT.md | 11 +++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/.github/drone.yml b/.github/drone.yml index a2f4e06b7..a20d5ef12 100644 --- a/.github/drone.yml +++ b/.github/drone.yml @@ -306,6 +306,35 @@ 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 @@ -332,6 +361,8 @@ steps: when: event: - tag + status: + - success - name: cleanup-ci-images image: docker:24.0.6 diff --git a/deploy/RELEASE_DEPLOYMENT.md b/deploy/RELEASE_DEPLOYMENT.md index 5ee866677..ef13d2430 100644 --- a/deploy/RELEASE_DEPLOYMENT.md +++ b/deploy/RELEASE_DEPLOYMENT.md @@ -17,7 +17,7 @@ owns CI validation, artifact transfer, and production deployment. - export and transfer the target images; - load the images and recreate the production application services; - verify the proxied API health endpoint; - - send a Feishu notification after deployment succeeds. + - 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. @@ -77,9 +77,12 @@ 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`. -After the health check succeeds, Drone sends the deployed tag, build link, and -short commit SHA to the configured Feishu custom bot. A notification API error -fails the Drone step so the missing notification is visible. +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