Rollback plan (dry-run)
Verify previous dir → atomically switch back → retain the failed version as previous → keep diagnostics; NO_PREVIOUS_RELEASE when no previous exists.
Inputs and parameters
siteId— Site siteIdcurrentRelease— Current failed release (optional)previousRelease— Previous release to restore
Real example
siteId=pdf, currentRelease=0.1.0, previousRelease=0.0.9
→ ok=true;retained=["0.0.9","0.1.0"];deployed=false;statusText="未部署/待授权"
Limits and failure handling
Does not delete other sites to free resources; rollback is a local state-machine simulation.
FAQ
Can we roll back without a previous release?
No. "Retain at least one previous release" is mandatory; the script returns NO_PREVIOUS_RELEASE.