refactor: move DOKKU_WAIT_TO_RETIRE to a checks property

This centralizes the property and removes one more dokku-specific property from the app environment variables.

Closes #5049
This commit is contained in:
Jose Diaz-Gonzalez
2022-11-15 23:25:58 -05:00
parent 4749d1529e
commit f5c3b5dc34
10 changed files with 140 additions and 14 deletions

View File

@@ -4,6 +4,26 @@ set -eo pipefail
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
migrate_checks_vars_0_29_0() {
declare desc="migrates deprecated DOKKU_WAIT_TO_RETIRE config variables to simplified counter part introduced in 0.29.x"
local wait_to_retire=$(config_get --global DOKKU_WAIT_TO_RETIRE || true)
if [[ -n "$wait_to_retire" ]]; then
dokku_log_info1 "Migrating deprecated global DOKKU_WAIT_TO_RETIRE to scheduler-docker-local property."
fn-plugin-property-write "checks" --global "wait-to-retire" "$wait_to_retire"
DOKKU_QUIET_OUTPUT=1 config_unset --global DOKKU_WAIT_TO_RETIRE || true
fi
for app in $(dokku_apps "false"); do
local wait_to_retire=$(config_get "$app" DOKKU_WAIT_TO_RETIRE || true)
if [[ -n "$wait_to_retire" ]]; then
dokku_log_info1 "Migrating deprecated DOKKU_WAIT_TO_RETIRE to scheduler-docker-local property for $app."
fn-plugin-property-write "checks" "$app" "wait-to-retire" "$wait_to_retire"
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$app" DOKKU_WAIT_TO_RETIRE || true
fi
done
}
migrate_checks_vars_0_5_0() {
declare desc="migrates deprecated CHECKS config variables to simplified counter part introduced in 0.5.x"
local GLOBAL_SKIP_ALL_CHECKS=$(config_get --global DOKKU_SKIP_ALL_CHECKS || true)