feat(ci): 金丝雀发布流水线(#450) #879

Merged
xiaoxia merged 1 commits from feat/ci-canary-release into develop 2026-07-25 14:43:37 +08:00
Owner

概述

建立生产金丝雀发布机制,降低发布风险。

变更内容

新增

  • scripts/ci/canary_release.sh - 金丝雀发布主脚本
    • 分阶段灰度:5% → 20% → 50% → 100%全量
    • 每阶段自动健康检查(API + Web)
    • 观察期内持续监控,异常自动回滚
    • 支持 SSH 远程执行,脚本自动上传到生产服务器

修改

  • .gitea/workflows/ci-pipeline.yml
    • 新增 canary-release job:main分支push自动触发
    • 依赖 staging-api-tests + build-production 通过
    • build-production 支持main分支构建(镜像标签 main-<sha前8位>

灰度策略

阶段 流量比例 观察期 健康检查
1 5% 10min API+Web
2 20% 15min API+Web
3 50% 20min API+Web
4 100%全量 - 最终验证

回滚机制

  • 任一阶段健康检查失败 → 自动执行 rollback_gray.sh 切回稳定版本
  • 全量部署失败 → 依赖 ci_production_deploy.sh 内置回滚
  • 失败自动通知

关联工单

  • #450 金丝雀发布
  • #619 [CI] 稳定性全面根治(P3-5)
## 概述 建立生产金丝雀发布机制,降低发布风险。 ## 变更内容 ### 新增 - **`scripts/ci/canary_release.sh`** - 金丝雀发布主脚本 - 分阶段灰度:5% → 20% → 50% → 100%全量 - 每阶段自动健康检查(API + Web) - 观察期内持续监控,异常自动回滚 - 支持 SSH 远程执行,脚本自动上传到生产服务器 ### 修改 - **`.gitea/workflows/ci-pipeline.yml`** - 新增 `canary-release` job:main分支push自动触发 - 依赖 staging-api-tests + build-production 通过 - build-production 支持main分支构建(镜像标签 `main-<sha前8位>`) ## 灰度策略 | 阶段 | 流量比例 | 观察期 | 健康检查 | |------|---------|--------|----------| | 1 | 5% | 10min | API+Web | | 2 | 20% | 15min | API+Web | | 3 | 50% | 20min | API+Web | | 4 | 100%全量 | - | 最终验证 | ## 回滚机制 - 任一阶段健康检查失败 → 自动执行 `rollback_gray.sh` 切回稳定版本 - 全量部署失败 → 依赖 `ci_production_deploy.sh` 内置回滚 - 失败自动通知 ## 关联工单 - #450 金丝雀发布 - #619 [CI] 稳定性全面根治(P3-5)
xiaoxia added 1 commit 2026-07-25 14:33:24 +08:00
feat(ci): 金丝雀发布流水线 #450
AI Code Review / AI Code Review (pull_request) Failing after 0s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 13s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m2s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 31s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 55s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 34s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 33s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 2m8s
Preview Deploy / Deploy Preview Environment (pull_request) Failing after 11s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 3m25s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m56s
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Successful in 1m51s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 3m21s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 5m24s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 19s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Failing after 21s
2ad9b84241
xiaoxia merged commit a9aface0b8 into develop 2026-07-25 14:43:37 +08:00

🗑️ 预览环境已清理

PR #879 已关闭或合并,对应的预览环境已被清理。

如有需要,可以重新打开 PR 来重新生成预览环境。

🗑️ **预览环境已清理** PR #879 已关闭或合并,对应的预览环境已被清理。 > 如有需要,可以重新打开 PR 来重新生成预览环境。
Sign in to join this conversation.