fix(deploy): keep broker credentials active during update rollback

Preserve broker environment and the active keyring mount when rolling application images back. Guard with update staging tests: 54 passed. No runtime services changed.
This commit is contained in:
ex_tianzy
2026-11-04 18:16:53 +08:00
parent 660d7a48d2
commit db116284b1
2 changed files with 10 additions and 2 deletions
+6 -2
View File
@@ -390,8 +390,12 @@ def prepare_update(args):
if mount['target']=='/run/hainuo-credentials/keyring.json':
mount['source']=str(output/'credential-keyring.json')
write_json(output/'compose.broker.json',overlay)
write_json(output/'compose.rollback.json',{'services':{name:{'image':roles[name]['image']}
for name in ('connector','router','longconn','enrollment-signer')}})
rollback=json.loads(json.dumps(overlay))
for name in ('connector','router'):
rollback['services'][name]['image']=roles[name]['image']
# An update rollback must retain broker env/key mounts, never silently
# revert to the original legacy credential owner from base Compose files.
write_json(output/'compose.rollback.json',rollback)
payload=output/'build';payload.mkdir(mode=0o700)
for path in (source/'relay').rglob('*'):
if path.is_symlink():raise DeployError('symlink in update source')