Files
awoooi/.github/workflows/daily-e2e-health.yaml
OG T 505e81b412 feat(ci): Daily E2E Health 改用 VIP 端點
- 將 API URL 從 192.168.0.120:32334 改為 192.168.0.125:32334
- 使用 keepalived VIP 取代直連單節點
- 提升 CI/CD 高可用性

Ref: ADR-033 Phase K-NET

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-28 18:11:38 +08:00

113 lines
3.6 KiB
YAML
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.
# =============================================================================
# AWOOOI Daily E2E Health Check (Phase 18.3)
# =============================================================================
# 🎯 每日端到端驗證Alert → AI → Approval → Execution
#
# 觸發時機:
# - 每日 00:30 UTC (08:30 台北)
# - 手動觸發
#
# 驗證內容:
# - E2E Tool Call 完整流程
# - Safe Mode 防護機制
# - 目標資源驗證
#
# 失敗通知: Telegram
name: Daily E2E Health Check
on:
schedule:
- cron: '30 0 * * *' # 每日 00:30 UTC (08:30 台北)
workflow_dispatch:
inputs:
api_url:
description: 'API URL to test'
required: false
default: 'http://192.168.0.125:32334'
dry_run:
description: 'Dry run mode (skip actual approval)'
required: false
default: 'true'
type: choice
options:
- 'true'
- 'false'
concurrency:
group: daily-e2e
cancel-in-progress: true
env:
PYTHON_VERSION: '3.11'
DEFAULT_API_URL: http://192.168.0.125:32334
jobs:
e2e-health-check:
name: E2E Health Check
runs-on: [self-hosted, harbor, k8s]
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install dependencies
working-directory: apps/api
run: uv sync
- name: Check API Health
run: |
API_URL="${{ github.event.inputs.api_url || env.DEFAULT_API_URL }}"
echo "🔗 檢查 API 健康狀態..."
if curl -s --connect-timeout 10 "$API_URL/health" > /dev/null; then
echo "✅ API 可用: $API_URL"
else
echo "❌ API 無法連線: $API_URL"
exit 1
fi
- name: Run E2E Verification
id: e2e
working-directory: apps/api
env:
PYTHONPATH: ${{ github.workspace }}/apps/api
run: |
API_URL="${{ github.event.inputs.api_url || env.DEFAULT_API_URL }}"
DRY_RUN="${{ github.event.inputs.dry_run || 'true' }}"
echo "🎯 執行 E2E Tool Call Verification v2.0"
echo " API: $API_URL"
echo " Dry Run: $DRY_RUN"
if [ "$DRY_RUN" = "true" ]; then
uv run python -m scripts.e2e_tool_call_verification --api-url "$API_URL" --dry-run
else
uv run python -m scripts.e2e_tool_call_verification --api-url "$API_URL" --no-dry-run
fi
- name: Summary
if: always()
run: |
echo "## Daily E2E Health Check 完成" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| 項目 | 值 |" >> $GITHUB_STEP_SUMMARY
echo "|------|-----|" >> $GITHUB_STEP_SUMMARY
echo "| API URL | ${{ github.event.inputs.api_url || env.DEFAULT_API_URL }} |" >> $GITHUB_STEP_SUMMARY
echo "| 時間 | $(TZ='Asia/Taipei' date '+%Y-%m-%d %H:%M:%S') |" >> $GITHUB_STEP_SUMMARY
echo "| 結果 | ${{ steps.e2e.outcome }} |" >> $GITHUB_STEP_SUMMARY
# Phase 18.3.2: 失敗時 Telegram 通知
- name: Notify on Failure
if: failure()
run: |
curl -s -X POST "https://api.telegram.org/bot${{ secrets.OPENCLAW_TG_BOT_TOKEN }}/sendMessage" \
-d "chat_id=${{ secrets.OPENCLAW_TG_CHAT_ID }}" \
-d "text=❌ Daily E2E Health Check 失敗%0A時間: $(TZ='Asia/Taipei' date '+%Y-%m-%d %H:%M')%0A詳情: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"