diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-19 19:45:36 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-19 19:45:36 +0800 |
| commit | 28822be822e27fec96bc43fbe6ac0c3f73f43841 (patch) | |
| tree | 05c335c05648669cd75949e7157ee262e9f94898 /deploy/scripts | |
| parent | 9d71d06a1f3ee294634bf45373bbf1944bf03caf (diff) | |
| download | blog-28822be822e27fec96bc43fbe6ac0c3f73f43841.tar.gz | |
[Problem]
- Failed rollback could delete a directory still used by current.
[Root Cause]
- Failure cleanup did not check the active symlink target.
[Solution]
- Preserve release directories still referenced by current.
- Document the self-hosted publishing and manual rollback procedure.
[Impact]
- Blog deployment cleanup is safer; article content remains unchanged.
Diffstat (limited to 'deploy/scripts')
| -rwxr-xr-x | deploy/scripts/build.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/deploy/scripts/build.sh b/deploy/scripts/build.sh index b76d6ec0..e598700a 100755 --- a/deploy/scripts/build.sh +++ b/deploy/scripts/build.sh @@ -113,12 +113,22 @@ while :; do && echo "rolled back to $prev" >> "$LOG" \ || echo "ROLLBACK FAILED: current -> $DEST_NAME stays" >> "$LOG" fi - rm -rf -- "$RELEASES/$DEST_NAME" + live=$(readlink "$RELEASES/current" 2>/dev/null || true) + if [ "$live" != "$DEST_NAME" ]; then + rm -rf -- "$RELEASES/$DEST_NAME" + else + echo "kept $DEST_NAME: current still points at it" >> "$LOG" + fi RC_LAST=1 fi fi if [ "$OK" -eq 0 ]; then - rm -rf -- "$RELEASES/$DEST_NAME" + live=$(readlink "$RELEASES/current" 2>/dev/null || true) + if [ "$live" != "$DEST_NAME" ]; then + rm -rf -- "$RELEASES/$DEST_NAME" + else + echo "kept $DEST_NAME: current still points at it" >> "$LOG" + fi echo "==== build $TS FAILED at publish, previous release kept ====" >> "$LOG" RC_LAST=1 fi |
