From c5c2941674c368068421d58ed0a4eb6748d2f9c7 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 7 Feb 2023 02:45:36 -0500 Subject: [PATCH] fix: pull the new docker image when upgrading a service if DOCKER_IMAGE_PULL is not disabled Refs dokku/dokku-clickhouse#51 --- subcommands/upgrade | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subcommands/upgrade b/subcommands/upgrade index 899f7e2..39110e7 100755 --- a/subcommands/upgrade +++ b/subcommands/upgrade @@ -38,6 +38,16 @@ service-upgrade-cmd() { return fi + if ! service_image_exists "$SERVICE"; then + if [[ "$PLUGIN_DISABLE_PULL" == "true" ]]; then + dokku_log_warn "${PLUGIN_DISABLE_PULL_VARIABLE} environment variable detected. Not running pull command." 1>&2 + dokku_log_warn " docker pull ${IMAGE}" 1>&2 + dokku_log_warn "$PLUGIN_SERVICE service $SERVICE upgrade failed" + exit 1 + fi + docker pull "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION" || dokku_log_fail "$PLUGIN_SERVICE image $PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION pull failed" + fi + service_commit_config "$SERVICE" dokku_log_info2 "Upgrading $SERVICE to $NEW_PLUGIN_IMAGE_TAG"