From 1380b4a50a242ed1c449215829bbcab6c5c49c32 Mon Sep 17 00:00:00 2001 From: Don Restarone <35935196+donrestarone@users.noreply.github.com> Date: Mon, 5 Dec 2022 21:50:35 -0500 Subject: [PATCH] [CI] Job to delete all review apps (#1279) (#1280) The code changes will delete the review-apps' folder on dokku EC2 instance if its folder still exists while cleaning up all review-apps. Co-authored-by: Prashant Khadka Co-authored-by: Don Restarone <35935196+donrestarone@users.noreply.github.com> --- .github/workflows/dokku-clean-review-apps.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/dokku-clean-review-apps.yml b/.github/workflows/dokku-clean-review-apps.yml index b1aa00dd1..26217e843 100644 --- a/.github/workflows/dokku-clean-review-apps.yml +++ b/.github/workflows/dokku-clean-review-apps.yml @@ -31,6 +31,13 @@ jobs: dokku postgres:exists "${APP_NAME}-db" && dokku postgres:destroy "${APP_NAME}-db" --force; dokku redis:exists "${APP_NAME}-redis" && dokku redis:destroy "${APP_NAME}-redis" --force; + if [ -d /home/dokku/$APP_NAME ]; then + echo "Folder of ${APP_NAME} still exists.\nDeleting it manually."; + sudo rm -rf /home/dokku/$APP_NAME; + + [ -d /home/dokku/$APP_NAME ] && echo "Could not delete ${APP_NAME}." || echo "${APP_NAME} deleted successfully."; + fi + echo "Deletion of ${APP_NAME} app, ${APP_NAME}-db and ${APP_NAME}-redis completed."; }; done; \ No newline at end of file