Files
dokku/plugins/scheduler-docker-local/post-delete
Jose Diaz-Gonzalez afc318526c refactor: move crontab writing code to scheduler-docker-local plugin
The implementation was very heavily docker-local specific and thus didn't make a ton of sense to keep in the cron plugin.

This also re-introduces changes from #5908 to parallelize the crontab generation (which is also specific to the docker-local scheduler) that were lost during a rebase.

The impetus for this change was implementing a `cron:run` command. The logic for actually running the command isn't scheduler specific - merely invoking `dokku run` with the appropriate arguments - but all the logic around how the commands were retrieved were, so the change was made pre-emptively.
2023-08-05 10:58:57 -04:00

22 lines
742 B
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"
trigger-scheduler-docker-local-post-delete() {
declare desc="scheduler-docker-local post-delete plugin trigger"
declare trigger="post-delete"
declare APP="$1"
fn-plugin-property-destroy "scheduler-docker-local" "$APP"
rm -rf "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP"
# remove all application containers
"$DOCKER_BIN" container ls --filter "label=com.dokku.app-name=${APP}" -q | xargs -n1 -I {} "$DOCKER_BIN" container rm --force {} &>/dev/null || true
plugn trigger cron-write
}
trigger-scheduler-docker-local-post-delete "$@"