From 10468ce47dae32659af2efe5bb0111413c571c27 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 13 Mar 2024 05:37:06 -0400 Subject: [PATCH] fix: ensure we cleanup the data directory on app deletion Also use a variable for the clone root dir. --- plugins/git/internal-functions | 7 +++++-- plugins/git/post-delete | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index a38a41f53..307669888 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -196,10 +196,12 @@ cmd-git-sync() { verify_app_name "$APP" - if [[ -d "$DOKKU_LIB_ROOT/data/git/$APP" ]]; then + local APP_CLONE_ROOT="$DOKKU_LIB_ROOT/data/git/$APP" + + if [[ -d "$APP_CLONE_ROOT" ]]; then if has_tty eq 0; then cmd-git-unlock "$APP" - if [[ -d "$DOKKU_LIB_ROOT/data/git/$APP" ]]; then + if [[ -d "$APP_CLONE_ROOT" ]]; then dokku_log_fail "Failed to delete existing clone folder" exit 15 fi @@ -266,6 +268,7 @@ cmd-git-unlock() { dokku_log_info1 "No clone folder exists app already unlocked" fi } + cmd-git-public-key() { declare desc="outputs the dokku public deploy key" local cmd="git:public-key" diff --git a/plugins/git/post-delete b/plugins/git/post-delete index dad74439a..490782dd8 100755 --- a/plugins/git/post-delete +++ b/plugins/git/post-delete @@ -7,8 +7,10 @@ trigger-git-post-delete() { declare desc="destroys the git properties for a given app" declare trigger="post-delete" declare APP="$1" + local APP_CLONE_ROOT="$DOKKU_LIB_ROOT/data/git/$APP" fn-plugin-property-destroy "git" "$APP" + rm -rf "$APP_CLONE_ROOT" } trigger-git-post-delete "$@"