diff --git a/plugins/common/functions b/plugins/common/functions index 4986d6f45..55c6a2ef2 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -311,16 +311,18 @@ fn-verify-app-image() { DOCKER_CONFIG="$(fn-registry-docker-config-dir "$APP")" [[ -n "$DOCKER_CONFIG" ]] && export DOCKER_CONFIG - local REMOTE_REPO + local REMOTE_REPO DEPLOYED_REPO TAG REMOTE_REPO="$(plugn trigger deployed-app-repository "$APP")" + DEPLOYED_REPO="$(plugn trigger deployed-app-image-repo "$APP")" + TAG="${IMAGE##*:}" dokku_log_info1 "Image $IMAGE not found locally, pulling from registry" 1>&2 - if [[ "$IMAGE" == "${REMOTE_REPO}"* ]]; then + if [[ -n "$DEPLOYED_REPO" ]] && [[ "$IMAGE" == "${REMOTE_REPO}${DEPLOYED_REPO}:"* ]]; then "$DOCKER_BIN" image pull "$IMAGE" 1>&2 && return 0 return 1 fi - local REMOTE_IMAGE="${REMOTE_REPO}${IMAGE}" + local REMOTE_IMAGE="${REMOTE_REPO}${DEPLOYED_REPO:-${IMAGE%:*}}:${TAG}" if "$DOCKER_BIN" image pull "$REMOTE_IMAGE" 1>&2; then "$DOCKER_BIN" image tag "$REMOTE_IMAGE" "$IMAGE" 1>&2 && return 0 fi diff --git a/tests/unit/registry_2.bats b/tests/unit/registry_2.bats index 927b955b9..f6d8e6181 100644 --- a/tests/unit/registry_2.bats +++ b/tests/unit/registry_2.bats @@ -105,8 +105,16 @@ setup_push_on_release_app() { run /bin/bash -c "dokku config:set $TEST_APP RECOVERY_KEY=value" echo "output: $output" echo "status: $status" + assert_success # triggerRestart forwards the deployed numeric tag (not "latest") to # release-and-deploy, so the wrapper attempts recovery against ":1" rather # than skipping recovery for ":latest" which is never pushed. assert_output_contains "dokku/$TEST_APP:1 not found locally, pulling from registry" + + # The wrapper retags the registry image back to the bare local name so + # subsequent get_app_image_name inspects resolve. + run /bin/bash -c "docker image inspect dokku/$TEST_APP:1" + echo "output: $output" + echo "status: $status" + assert_success } diff --git a/tests/unit/storage.bats b/tests/unit/storage.bats index 803c80047..f3d11f544 100644 --- a/tests/unit/storage.bats +++ b/tests/unit/storage.bats @@ -443,7 +443,7 @@ teardown() { echo "output: $output" echo "status: $status" assert_success - assert_output_contains "deprecated" + assert_output_contains "Deprecated:" } @test "(storage:migrate) leaves legacy-mounts-migrated unset for apps with no legacy -v lines" {