fix(deploy): prune unused staging images before digest pull
Independent Staging Quality Gate / validate (push) Successful in 16m51s
Independent Staging Quality Gate / publish (push) Successful in 6m45s

BUG-994: migrate run 2841 failed writing containerd ingest because the staging host had no space left after accumulated exact-SHA images.
This commit is contained in:
jesse-ux
2026-09-21 22:59:07 +08:00
parent f9685f2837
commit a06829b33e
4 changed files with 52 additions and 1 deletions
@@ -1008,7 +1008,13 @@ test("normal deployment checks migrations but never applies them", () => {
for (const workflow of stagingWorkflows) {
assert.doesNotMatch(workflow, /SERVICE_RUNTIME_PASSWORD|SERVICE_DATABASE_URL/);
}
// 原值: pull api web 前不回收镜像
// 新值: image prune --all --force 必须出现在 pull 之前,且不得 volume prune
// 原因: BUG-994 / migrate run 2841 在 staging 主机拉 digest 时 containerd 写满
assert.match(runner, /image prune --all --force/);
assert.doesNotMatch(runner, /volume prune --/);
assertOrder(runner, [
"image prune --all --force",
"pull api web",
"up -d --no-build --pull never --wait postgres",
"--profile migration-check run --rm migration-checker",
@@ -1036,6 +1042,15 @@ test("manual migration uses only PostgreSQL and the digest-pinned migrator", ()
assert.match(workflow, /^on:\n\s+workflow_dispatch:/m);
assert.doesNotMatch(workflow, /workflow_run:|\n\s+push:/);
assert.match(runner, /"\$\{docker_command\[@\]\}" pull "\$WEB_IMAGE"/);
// 原值: docker pull "$WEB_IMAGE" 前不回收镜像
// 新值: image prune --all --force 必须出现在 pull 之前,且不得 volume prune
// 原因: BUG-994 / migrate run 2841 在 staging 主机拉 digest 时 containerd 写满
assert.match(runner, /image prune --all --force/);
assert.doesNotMatch(runner, /volume prune --/);
assertOrder(runner, [
"image prune --all --force",
'"${docker_command[@]}" pull "$WEB_IMAGE"',
]);
assert.match(runner, /up -d --no-build --pull never --wait postgres/);
assert.match(runner, /-f deploy\/docker-compose\.postgres\.yml/);
assertOrder(runner, [