docs: 建立 Secret 生命周期治理跟踪
Pipelines as Code CI / hwlab-web-probe-sentinel-nc01- Success
Pipelines as Code CI / platform-infra-gitea-nc01- Success
Pipelines as Code CI / unidesk-host- Success

This commit is contained in:
Codex
2026-07-16 16:38:36 +02:00
parent 3f6290df85
commit 7b5e219f72
2 changed files with 117 additions and 0 deletions
+41
View File
@@ -7,6 +7,8 @@ description: UniDesk 统一管理员密码的 YAML-first 分发与清理技能
遵循 `Skill(cli-spec)`,只通过 owning YAML、领域受控 CLI 和 `web-probe` 分发与验收,不读取、打印或从运行面反解密码。
- 通用 Secret 生命周期、工具改进和跨服务治理任务统一跟踪于 `docs/MDTODO/secret-lifecycle-governance.md`;本 skill 只保留统一管理员密码的现行最短路径和判定标准。
## 唯一事实源
- 统一管理员密码只保存在 `/root/.unidesk/.env/unified-admin-password.txt`
@@ -41,6 +43,19 @@ description: UniDesk 统一管理员密码的 YAML-first 分发与清理技能
6.`web-probe` 从 owning YAML 选择 public origin,分别验证 development 与 production 管理员登录。
7. 只有所有目标分发和登录验收通过后,才清理旧服务级密码文件或 env 键。
运行面判定:
- Secret apply 成功但 consumer rollout 失败时,先用领域 status 区分运行面未部署和已部署 workload 异常:
- namespace 存在但 workload 为 `0/0` 时,记录为“Secret 已预置、登录不适用”,不得重复 restart 或宣称密码已在业务入口生效;
- workload 存在时,rollout 未 ready 属于分发未完成,禁止清理旧来源。
- 只使用已有 repo-owned typed command 验证登录:
- PikaOA development 使用 `web-probe product-smoke --product pikaoa --target NC01 --profile admin-mvp`
- Sub2Rank/ApiState 使用 `web-probe product-smoke --product apistate --target NC01 --profile operations`
- HWLAB 已部署 lane 使用 `web-probe run --node <node> --lane <lane> --origin public`
- PikaOA release 或 SelfMedia target 没有启用只读 typed login smoke 时:
- 不得复制临时浏览器脚本、手写 URL 或使用会保存业务设置的 SelfMedia `voice-algorithm` smoke 代替;
- 以 Secret status、consumer rollout 和公开 health 分层报告,并把缺失的只读登录入口登记为独立工具改进。
Secret 分发高频入口:
```bash
@@ -57,6 +72,32 @@ bun scripts/cli.ts secrets status --config config/secrets-distribution.yaml --sc
- `selfmedia-production` / `selfmedia-production-nc01`
- `sub2rank` / `sub2rank-nc01`
清理后的五目标最短复核入口:
```bash
while read -r scope target; do
bun scripts/cli.ts secrets plan \
--config config/secrets-distribution.yaml \
--scope "$scope" \
--target "$target" |
jq '{ok: .ok, targetId: .data.config.targetId, localSourcesOk: .data.localSources.ok, missingKeys: [.data.localSources.entries[] | .missingKeys[]?], unifiedPresent: ([.data.localSources.entries[] | select(.sourceRef == "/root/.unidesk/.env/unified-admin-password.txt") | .presence] | any), valuesPrinted: .data.policy.valuesPrinted}'
done <<'TARGETS'
pikaoa pikaoa-nc01
pikaoa-dev pikaoa-dev-nc01
selfmedia selfmedia-nc01
selfmedia-production selfmedia-production-nc01
sub2rank sub2rank-nc01
TARGETS
```
- 五行结果必须同时满足:
- `ok=true`
- `localSourcesOk=true`
- `missingKeys=[]`
- `unifiedPresent=true`
- `valuesPrinted=false`
- 该入口只做清理后反证,不替代 sync job 终态、运行面 status 或登录 smoke。
## 清理规则
- 删除 `pikaoa-admin-password.txt` 和含不可见字符的旧 unified 文件名。