feat: add bds core, locale updates and safety fixes
This commit is contained in:
30
lib/rollback.sh
Normal file
30
lib/rollback.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ROLLBACK_IN_PROGRESS="no"
|
||||
|
||||
rollback_on_error() {
|
||||
local exit_code="${1:-1}"
|
||||
local command_failed="${2:-unknown}"
|
||||
|
||||
if [[ "$ROLLBACK_IN_PROGRESS" == "yes" ]]; then
|
||||
return
|
||||
fi
|
||||
ROLLBACK_IN_PROGRESS="yes"
|
||||
|
||||
local fail_message
|
||||
fail_message="$(t deployment_failed "$exit_code" "$command_failed")"
|
||||
error "$fail_message"
|
||||
send_report "failed" "$fail_message"
|
||||
|
||||
warn "$(t rollback_starts "$SERVER_DIR")"
|
||||
|
||||
if [[ "${SERVICE_CREATED:-no}" == "yes" ]]; then
|
||||
remove_service_if_exists
|
||||
fi
|
||||
|
||||
if [[ -n "${LOG_FILE:-}" ]]; then
|
||||
info "$(t see_log "$LOG_FILE")"
|
||||
fi
|
||||
|
||||
exit "$exit_code"
|
||||
}
|
||||
Reference in New Issue
Block a user