fix: properly support new image and image-version values during plugin upgrades

Closes dokku/dokku-mongo#143
Closes dokku/dokku-redis#193
Closes dokku/dokku-redis#195
This commit is contained in:
Jose Diaz-Gonzalez
2023-02-07 06:53:40 -05:00
parent ed0894460c
commit a6ec1ffd8c
2 changed files with 16 additions and 14 deletions

View File

@@ -501,12 +501,18 @@ service_exposed_ports() {
service_image_exists() {
declare desc="check if the current image exists"
declare SERVICE="$1"
declare SERVICE="$1" PLUGIN_IMAGE="${2:-$PLUGIN_IMAGE}" PLUGIN_IMAGE_VERSION="${3:-$PLUGIN_IMAGE_VERSION}"
local plugin_image="$PLUGIN_IMAGE"
local plugin_image_version="$PLUGIN_IMAGE_VERSION"
[[ -f "$SERVICE_ROOT/IMAGE" ]] && plugin_image="$(cat "$SERVICE_ROOT/IMAGE")"
[[ -f "$SERVICE_ROOT/IMAGE_VERSION" ]] && plugin_image_version="$(cat "$SERVICE_ROOT/IMAGE_VERSION")"
if [[ -z "$PLUGIN_IMAGE" ]] && [[ -f "$SERVICE_ROOT/IMAGE" ]]; then
plugin_image="$(cat "$SERVICE_ROOT/IMAGE")"
fi
if [[ -z "$PLUGIN_IMAGE_VERSION" ]] && [[ -f "$SERVICE_ROOT/IMAGE_VERSION" ]]; then
plugin_image_version="$(cat "$SERVICE_ROOT/IMAGE_VERSION")"
fi
local IMAGE="$plugin_image:$plugin_image_version"
if [[ "$("$DOCKER_BIN" image ls -q "$IMAGE" 2>/dev/null)" == "" ]]; then