Files
xiaoxia-saas/scripts/ci/chatops/__init__.py
T
CI Bot 55347f962c
CI Build & Deploy Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Production (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 15s
Preview Deploy / Deploy Preview Environment (pull_request) Failing after 16s
AI Code Review / AI Code Review (pull_request) Failing after 23s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 49s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Successful in 1m55s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 2m52s
Auto Approve CI PRs / Auto Approve on CI Green (pull_request) Successful in 3m17s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 1m31s
Auto Merge CI PRs / Auto Merge on CI Green + Approved (pull_request) Successful in 3m56s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 20s
feat(ci): P2-2 ChatOps集成 - 飞书机器人对接Gitea Actions
新增 scripts/ci/chatops/ 目录,Python实现,纯工具链扩展不动业务代码。

3个核心模块:
- ci_query.py    - 查询CI状态(分支/PR/失败详情)
- ci_trigger.py  - 触发重跑(rerun失败job/整个workflow/取消)
- feishu_notify.py - CI事件飞书通知(失败/恢复/E2E摘要)

配套基础设施:
- config.py      - 配置化,所有token/webhook走环境变量
- gitea_client.py - Gitea API统一封装(urllib实现,无第三方依赖)
- webhook_server.py - FastAPI webhook接收服务(可选依赖)

通知规则(最高频使用场景):
- main/develop分支CI失败 → 飞书告警卡片(含失败摘要+一键重跑)
- 分支从失败恢复 → 绿色恢复通知(含故障时长)
- E2E测试失败 → 单独摘要通知
- 连续失败不重复告警(状态缓存去重)

飞书交互命令(第一版已实现解析+执行):
- /ci status [branch]   - 查询分支CI状态
- /ci rerun <run-id>    - 重跑失败jobs
- /ci rerun latest [branch] - 重跑最近一次失败的run
- /ci help              - 帮助

black+ruff全绿,与现有ci脚本风格一致。
2026-07-18 18:38:11 +08:00

20 lines
498 B
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""CI ChatOps 工具包 - 飞书机器人对接 Gitea Actions
模块:
config - 配置管理(环境变量)
gitea_client - Gitea API 客户端封装
feishu_notify - 飞书通知(失败/恢复/E2E摘要)
ci_query - CI 状态查询
ci_trigger - CI 重跑触发
webhook_server - Gitea webhook 接收服务(FastAPI
"""
__all__ = [
"config",
"gitea_client",
"feishu_notify",
"ci_query",
"ci_trigger",
"webhook_server",
]