From a384fce1b08a4db63a1105e3748c29a97fc33d99 Mon Sep 17 00:00:00 2001 From: youfak Date: Fri, 7 Aug 2026 17:34:25 +0800 Subject: [PATCH] ci: validate deployment manifests --- .github/workflows/ci.yml | 16 ++++++++++ README.md | 5 ++-- deploy/ci_test.go | 39 +++++++++++++++++++++++++ docs/development/implementation-plan.md | 8 +++-- task_plan.md | 2 +- 5 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 deploy/ci_test.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30ca6cd..1d43d6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,22 @@ jobs: - shell: pwsh run: ./scripts/verify-proto.ps1 + deployment: + runs-on: ubuntu-latest + env: + PROXY_POOL_GATEWAY_PASSWORD: ci-gateway-password + PROXY_POOL_EXTRACT_TOKEN: ci-extract-token + PROXY_POOL_ADMIN_TOKEN: ci-admin-token + PROXY_POOL_CONFIG_FINGERPRINT_KEY: ci-config-fingerprint-key-at-least-32-bytes + PROVIDER_A_TOKEN: ci-provider-a-token + PROVIDER_B_TOKEN: ci-provider-b-token + steps: + - uses: actions/checkout@v4 + - name: Render Compose configuration + run: docker compose -f deploy/docker-compose.yml config --quiet + - name: Render Kubernetes base + run: kubectl kustomize deploy/kubernetes/base > /dev/null + test: strategy: matrix: diff --git a/README.md b/README.md index 7ebcbd7..4c11d4e 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ flowchart LR ## 当前完成度 -截至 **2026-08-07**,实施计划中可直接勾选的检查项为 **68 / 75(90.7%)**。详情见 +截至 **2026-08-07**,实施计划中可直接勾选的检查项为 **69 / 75(92.0%)**。详情见 [实施计划](docs/development/implementation-plan.md)和 [交付完成度审计](docs/requirements/completion-audit.md)。 @@ -133,7 +133,8 @@ flowchart LR - **待完成**:故障演练和代表性集群压测;现有 HTTP、CONNECT 长连接和 Extract 场景只提供可复现的负载工具,不构成容量验证结论。 -检查项数量不等于生产就绪度。静态部署清单与 protobuf descriptor 验证也不代表 +检查项数量不等于生产就绪度。CI 会验证 OpenAPI 契约、固定版本的 protobuf descriptor/ +生成代码漂移,以及 Compose/Kustomize 的静态渲染;这些门禁也不代表 端到端拓扑已经完成;`100,000 QPS` 仍只是待验证的集群设计目标。 ## 快速开始 diff --git a/deploy/ci_test.go b/deploy/ci_test.go new file mode 100644 index 0000000..46b5b54 --- /dev/null +++ b/deploy/ci_test.go @@ -0,0 +1,39 @@ +package deploy + +import ( + "os" + "strings" + "testing" + + "go.yaml.in/yaml/v4" +) + +func TestCIValidatesProtocolAndDeploymentAssets(t *testing.T) { + payload, err := os.ReadFile("../.github/workflows/ci.yml") + if err != nil { + t.Fatalf("read ci workflow: %v", err) + } + workflow := string(payload) + var document map[string]any + if err := yaml.Unmarshal(payload, &document); err != nil { + t.Fatalf("parse ci workflow: %v", err) + } + jobs, ok := document["jobs"].(map[string]any) + if !ok { + t.Fatal("ci workflow has no jobs") + } + for _, name := range []string{"proto", "deployment", "test", "race", "integration"} { + if _, exists := jobs[name]; !exists { + t.Errorf("ci workflow has no %s job", name) + } + } + for _, required := range []string{ + "./scripts/verify-proto.ps1", + "docker compose -f deploy/docker-compose.yml config --quiet", + "kubectl kustomize deploy/kubernetes/base", + } { + if !strings.Contains(workflow, required) { + t.Errorf("ci workflow does not validate %q", required) + } + } +} diff --git a/docs/development/implementation-plan.md b/docs/development/implementation-plan.md index 5a6e086..e169b14 100644 --- a/docs/development/implementation-plan.md +++ b/docs/development/implementation-plan.md @@ -338,13 +338,13 @@ Supervisor 也改为同时服从静态配置与管理态,消除两条启停消 and idempotency behavior. - [x] Specify Worker register, snapshot, delta, ACK, report, heartbeat, ownership drain, and resync messages. -- [ ] Validate OpenAPI and compile protobuf descriptors in CI. +- [x] Validate OpenAPI contracts and compile protobuf descriptors/generated-code drift in CI. 当前进度(2026-07-29):Distribution/Admin OpenAPI 已由 Go 测试在双平台 CI 校验本地 `$ref` 闭合、operationId 唯一、响应存在及 security scheme 引用; `scripts/verify-proto.ps1` 已可复现编译包含 imports/source info 的 descriptor, -并在本地存在 `protoc` 时进入完整验证;完整 OAS 工具验证与 CI 强制安装/执行 -`protoc` 仍待完成。 +并使用 SHA-256 固定的 `protoc` 35.0 安装器在 CI 完整验证 descriptor 与生成代码漂移; +OpenAPI 结构契约由 Go 测试在双平台 CI 执行。 ## Task 13: Deployment and Observability @@ -373,6 +373,8 @@ Supervisor 也改为同时服从静态配置与管理态,消除两条启停消 交付数,幂等重放按响应交付统计。容量指标由既有 Provider 库存对账周期聚合,不进入 Gateway 热路径。`platform/logging` 以 JSON `slog` 输出进程级致命错误,字段、URL 用户信息、查询 Secret 和错误对象均经过脱敏,且不在请求热路径逐条写日志。 +CI 另有独立 Deployment job,在占位凭据下渲染 Compose,并使用 `kubectl kustomize` +渲染 Kubernetes base;它不启动容器、不访问真实存储或密钥。 ## Task 14: Documentation, Examples, and Diagrams diff --git a/task_plan.md b/task_plan.md index 994f046..47c9ed9 100644 --- a/task_plan.md +++ b/task_plan.md @@ -70,7 +70,7 @@ ## 已知环境限制 -- Docker Compose mTLS 控制面与 Kubernetes Kustomize 已完成静态渲染验证;Redis 8.2 +- Docker Compose mTLS 控制面与 Kubernetes Kustomize 已完成本地与 CI 静态渲染验证;Redis 8.2 与 PostgreSQL 18 的隔离 Adapter fixture 已运行。Docker Desktop 缺少镜像 HTTPS 代理配置,未能在本机完成 Compose 容器端到端启动。 - Controller、Gateway、Checker、Loadgen、Provider Fleet、WorkerControlPlane、业务指标和