feat: expose build identity for release verification

This commit is contained in:
2026-09-20 18:26:00 +08:00
parent b53cffd07d
commit a1ba6cb145
9 changed files with 86 additions and 6 deletions

View File

@@ -17,7 +17,17 @@ docker build --platform linux/amd64 -t registry.example/orbit:dev .
docker image inspect registry.example/orbit:dev --format '{{.Id}}'
```
生产发布应把标签绑定到不可变提交和镜像摘要,并在目标架构重新构建或执行等价的交叉构建核验。`registry.example` 只是占位符,不是平台依赖。
生产发布应把标签绑定到不可变提交和镜像摘要,并在目标架构重新构建或执行等价的交叉构建核验。构建时可注入版本身份:
```sh
docker build --platform linux/amd64 \
--build-arg VERSION=1.0.0 \
--build-arg REVISION="$(git rev-parse HEAD)" \
--build-arg BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-t registry.example/orbit:1.0.0 .
```
节点启动后通过 `GET /version` 核对这些值。`registry.example` 只是占位符,不是平台依赖。
## 2. 迁移、核验和启动
@@ -53,6 +63,7 @@ docker run --rm \
```text
GET /health/live 进程存活
GET /health/ready MySQL、迁移账本及零外键检查
GET /version 版本、提交和协议身份
```
`ready` 返回 `503` 时应摘除节点并保留原幂等键;不能把数据库连接失败解释为业务失败。metrics 监听由 `ORBIT_METRICS_ADDR` 单独启用,默认关闭,不应通过公共业务入口暴露。