feat: add subcommands to allow app locking and unlocking

Unlocking an app will not stop running deploys, so users may need to clean up. However, it is useful for deploys that fail in unusual ways that cause the lock to stay around.

Closes #2883
This commit is contained in:
Jose Diaz-Gonzalez
2018-03-04 01:04:21 -05:00
parent bed573ebe8
commit 165b6ff46f
7 changed files with 129 additions and 4 deletions

22
plugins/apps/subcommands/unlock Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
apps_unlock_cmd() {
declare desc="removes the '.deploy.lock' file from an application's repo"
declare cmd="apps:unlock"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"; verify_app_name "$APP"
if [[ -f "$DOKKU_ROOT/$APP/.deploy.lock" ]]; then
dokku_log_warn "A deploy may be in progress."
dokku_log_warn "Removing the application lock will not stop in progress deploys."
fi
rm -f "$DOKKU_ROOT/$APP/.deploy.lock" || dokku_log_fail "Unable to remove deploy lock"
dokku_log_info1 "Deploy lock removed."
}
apps_unlock_cmd "$@"