chennaji9 opened a new pull request, #5885:
URL: https://github.com/apache/rocketmq-dashboard/pull/5885

   ### Which Issue(s) This PR Fixes
   
   None — small self-contained fix found by inspection (no issue tracked).
   
   ### Brief Description
   
   The `upload_source` remote command separated its phases with `;` and ended 
with `|| true`, so a failed `tar xzf` still exited 0: the deploy continued with 
a wiped, partially extracted tree and only blew up much later in the docker 
build, far from the root cause. Worse, because `rm -rf server web deploy` had 
already removed the `deploy/` directory the failed extraction never recreated, 
the trailing restore `mv /tmp/deploy-env-backup deploy/.env` also failed — the 
preserved environment-specific `.env` was left only as the `/tmp` backup copy.
   
   Chain every phase with `&&` instead (best-effort only where the file may 
legitimately be absent):
   
   - a failed `.env` backup aborts **before** the wipe, so the remote config is 
never deleted without a backup;
   - a failed extraction (or cleanup) exits the remote command non-zero, so 
`set -e` stops the deploy at the failing step;
   - the `.env` restore still runs when extraction fails, and the `/tmp` backup 
survives for the next run.
   
   ### How Did You Test This Change?
   
   `bash -n deploy/deploy.sh` — syntax OK (shellcheck not available in this 
environment).
   
   Replayed the exact remote command string (old vs new) against a fake remote 
directory with `REMOTE_PATH`/`SRC_TAR` exported, `bash -c "$CMD"`:
   
   | scenario | old chain | new chain |
   |---|---|---|
   | corrupt tarball | exit **0**, `deploy/.env` gone from tree, deploy would 
continue | exit **2** (tar's own code), `/tmp/deploy-env-backup` intact for the 
next run |
   | healthy tarball | exit 0, `.env` restored, artifact removed | identical |
   
   No ssh/docker involved in the simulation; the command string is the one 
`run_remote` passes to ssh verbatim.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`fix:`)
   - [ ] Tests added or updated for non-trivial changes (shell behaviour 
verified by direct replay above; the repo has no shell test harness)
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/` 
(n/a — no UI change)
   - [x] Architecture constraints stay green (n/a — no Java change)
   - [x] New source files carry the ASF license header (n/a — no new source 
file)
   - [x] Documentation touched where behaviour changed (n/a — failure now stops 
the script, matching `set -e` intent)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to