From 223cca7f126fb0053478771c27298b373e507e48 Mon Sep 17 00:00:00 2001 From: Wyatt Walter Date: Tue, 2 Jun 2026 11:08:44 -0500 Subject: [PATCH] fix(scripts): exclude supervisor logs from deploy-preview recreate wipe The RECREATE path in deploy_preview.sh runs `rm -rf /appsmith-stacks/*` after `supervisorctl stop all`, but supervisord itself keeps running and holds files in /appsmith-stacks/logs/supervisor open. The directory therefore cannot be removed and the kubectl exec fails with "Directory not empty", aborting the workflow before the helm upgrade runs. Walk the tree in two passes instead, skipping logs/supervisor while clearing everything else under /appsmith-stacks. Co-Authored-By: Claude Opus 4.7 --- scripts/deploy_preview.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/deploy_preview.sh b/scripts/deploy_preview.sh index 8a53dde7c8f5..a62b1fe7ac27 100755 --- a/scripts/deploy_preview.sh +++ b/scripts/deploy_preview.sh @@ -47,7 +47,8 @@ if [[ -n "${RECREATE-}" ]]; then # execute this db.dropDatabase() from the k8s cluster because there's network restrictions on Atlas cluster. # The \$ is used to escape the $ character in the APPSMITH_DB_URL environment variable so it's interpolated inside the kubectl exec command. kubectl exec "$pod_name" -n "$NAMESPACE" -- bash -c "mongosh \$APPSMITH_DB_URL --eval 'db.dropDatabase()'" - kubectl exec "$pod_name" -n "$NAMESPACE" -- bash -c "supervisorctl stop all && rm -rf /appsmith-stacks/*" + # supervisord itself keeps running and holds files in logs/supervisor open, so exclude it from the wipe. + kubectl exec "$pod_name" -n "$NAMESPACE" -- bash -c "supervisorctl stop all && find /appsmith-stacks -mindepth 1 -maxdepth 1 ! -name logs -exec rm -rf {} + && find /appsmith-stacks/logs -mindepth 1 -maxdepth 1 ! -name supervisor -exec rm -rf {} +" kubectl delete ns "$NAMESPACE" || true kubectl patch pv "$NAMESPACE-appsmith" -p '{"metadata":{"finalizers":null}}' || true kubectl delete pv "$NAMESPACE-appsmith" --grace-period=0 --force || true