Skip to content

Commit c2e650c

Browse files
committed
fix(ci): mv legacy submodule paths aside instead of rm -rf
The previous rm -rf failed with permission denied on root-owned files inside eafw_geomanager_web/ (a leftover from the pre-Apr-1 monorepo layout that still contained shadow copies of LandScan, ASAP rasters, return-period tiffs and google-credentials.json). Renaming a directory only requires write+exec on the *parent*, not on the directory's children, so mv works regardless of who owns the files inside. This: - Preserves the legacy data untouched in <name>.legacy.<timestamp> - Frees the path for git submodule update --init to clone fresh - Lets the operator inspect or delete the .legacy backups manually, using docker root if needed, after a successful deploy Idempotent: once submodules are checked out, the (! -e $sub/.git) guard is false and the mv is skipped on subsequent deploys.
1 parent cdcb046 commit c2e650c

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

.github/workflows/deploy-staging.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,17 @@ jobs:
326326
cd $REPO_DIR
327327
fi
328328
329-
# One-time cleanup: legacy tracked directories from before the
329+
# One-time aside: legacy tracked directories from before the
330330
# submodule split linger on disk after a git reset --hard, blocking
331-
# the fresh submodule clone. Remove anything that isn't already a
332-
# git checkout itself.
331+
# the fresh submodule clone. Move (don't delete) anything that
332+
# isn't already a git checkout. Renaming the directory only needs
333+
# write access on the *parent*, so root-owned children inside the
334+
# legacy dir are preserved untouched in the .legacy backup.
335+
TS=$(date +%Y%m%d_%H%M%S)
333336
for sub in eafw_geomanager eafw_geomanager_web eafw_geomapviewer eafw_georeport; do
334337
if [ -d "$sub" ] && [ ! -e "$sub/.git" ]; then
335-
rm -rf "$sub"
336-
echo " cleaned stale legacy directory: $sub"
338+
mv "$sub" "${sub}.legacy.${TS}"
339+
echo " moved aside: $sub -> ${sub}.legacy.${TS}"
337340
fi
338341
done
339342

0 commit comments

Comments
 (0)