Concurrent commands for the same app could each read a setting, change it, and write it back, so all of them exited successfully while silently dropping changes made by the others. Updates to app settings are now serialized so every change is kept, and readers never see a partially written value.
54 lines
2.1 KiB
Bash
Executable File
54 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eo pipefail
|
|
[[ $DOKKU_TRACE ]] && set -x
|
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
|
|
|
|
cmd-checks-skip() {
|
|
declare desc="skip zero-downtime checks for app/proctypes"
|
|
declare cmd="checks:skip"
|
|
[[ "$1" == "$cmd" ]] && shift 1
|
|
declare APP="$1"
|
|
|
|
verify_app_name "$APP"
|
|
local PROCTYPES="${2:-_all_}"
|
|
fn-plugin-property-lock "checks" "$APP" fn-checks-skip "$APP" "$PROCTYPES"
|
|
}
|
|
|
|
fn-checks-skip() {
|
|
declare desc="skips zero-downtime checks for app/proctypes, expecting the caller to hold the checks property lock"
|
|
declare APP="$1" PROCTYPES="$2"
|
|
local DOKKU_CHECKS_DISABLED=$(fn-plugin-property-get-default "checks" "$APP" "disabled" "")
|
|
local DOKKU_CHECKS_SKIPPED=$(fn-plugin-property-get-default "checks" "$APP" "skipped" "")
|
|
|
|
if [[ "$PROCTYPES" == "_all_" ]]; then
|
|
dokku_log_info1 "Skipping zero downtime for app ($APP)"
|
|
fn-plugin-property-write "checks" "$APP" "skipped" "$PROCTYPES"
|
|
fn-plugin-property-delete "checks" "$APP" "disabled"
|
|
else
|
|
dokku_log_info1 "Skipping zero downtime for app's ($APP) proctypes ($PROCTYPES)"
|
|
local PROCTYPE OIFS="$IFS" IFS=,
|
|
for PROCTYPE in $PROCTYPES; do
|
|
IFS="$OIFS"
|
|
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "false" ]] \
|
|
&& DOKKU_CHECKS_SKIPPED="$(add_val_to_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")"
|
|
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "true" ]] \
|
|
&& DOKKU_CHECKS_DISABLED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")"
|
|
done
|
|
DOKKU_CHECKS_SKIPPED="$(remove_val_from_list "_all_" "$DOKKU_CHECKS_SKIPPED")"
|
|
if [[ -z "$DOKKU_CHECKS_DISABLED" ]]; then
|
|
fn-plugin-property-delete "checks" "$APP" "disabled"
|
|
else
|
|
fn-plugin-property-write "checks" "$APP" "disabled" "$DOKKU_CHECKS_DISABLED"
|
|
fi
|
|
|
|
if [[ -z "$DOKKU_CHECKS_SKIPPED" ]]; then
|
|
fn-plugin-property-delete "checks" "$APP" "skipped"
|
|
else
|
|
fn-plugin-property-write "checks" "$APP" "skipped" "$DOKKU_CHECKS_SKIPPED"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
cmd-checks-skip "$@"
|