feat(ci): rollback unhealthy deployments

This commit is contained in:
2026-08-22 18:26:47 +08:00
parent 1df87e5d17
commit ae9238b3cf
3 changed files with 388 additions and 23 deletions
@@ -101,3 +101,13 @@ test('source workspaces are preserved for incremental Git fetches', () => {
assert.equal((pipeline.match(/cleanWs\(/g) ?? []).length, 2)
assert.doesNotMatch(coordinatorPipeline, /cleanWs\(/)
})
test('direct deployments wait for health and automatically restore the previous image', () => {
assert.match(directDeployScript, /HEALTH_TIMEOUT_SECONDS="\$\{DEPLOY_HEALTH_TIMEOUT_SECONDS:-240\}"/)
assert.match(directDeployScript, /previous_image="\$\(local_container_image \|\| true\)"/)
assert.match(directDeployScript, /if wait_for_local_health; then/)
assert.match(directDeployScript, /开始自动回滚到/)
assert.match(directDeployScript, /自动回滚成功/)
assert.match(directDeployScript, /自动回滚失败/)
assert.match(directDeployScript, /return 1/)
})