fix: pull registry-aware image name on local miss
When `image-repo` is overridden, the registry plugin pushes under that name and
the bare local `dokku/<app>:N` tag is never created. `fn-verify-app-image` now
queries the `deployed-app-image-repo` trigger and pulls `${REMOTE_REPO}${DEPLOYED_REPO}:${TAG}`,
retagging it as the local bare reference so subsequent inspects resolve. Also
aligns the `storage:ensure-directory` deprecation test assertion with the
standardized `Deprecated:` prefix.
This commit is contained in:
3 files changed
+14
-4
No files matched your search
@@ -311,16 +311,18 @@ fn-verify-app-image() {
|
|||||||
DOCKER_CONFIG="$(fn-registry-docker-config-dir "$APP")"
|
DOCKER_CONFIG="$(fn-registry-docker-config-dir "$APP")"
|
||||||
[[ -n "$DOCKER_CONFIG" ]] && export DOCKER_CONFIG
|
[[ -n "$DOCKER_CONFIG" ]] && export DOCKER_CONFIG
|
||||||
|
|
||||||
local REMOTE_REPO
|
local REMOTE_REPO DEPLOYED_REPO TAG
|
||||||
REMOTE_REPO="$(plugn trigger deployed-app-repository "$APP")"
|
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
|
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
|
"$DOCKER_BIN" image pull "$IMAGE" 1>&2 && return 0
|
||||||
return 1
|
return 1
|
||||||
fi
|
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
|
if "$DOCKER_BIN" image pull "$REMOTE_IMAGE" 1>&2; then
|
||||||
"$DOCKER_BIN" image tag "$REMOTE_IMAGE" "$IMAGE" 1>&2 && return 0
|
"$DOCKER_BIN" image tag "$REMOTE_IMAGE" "$IMAGE" 1>&2 && return 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -105,8 +105,16 @@ setup_push_on_release_app() {
|
|||||||
run /bin/bash -c "dokku config:set $TEST_APP RECOVERY_KEY=value"
|
run /bin/bash -c "dokku config:set $TEST_APP RECOVERY_KEY=value"
|
||||||
echo "output: $output"
|
echo "output: $output"
|
||||||
echo "status: $status"
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
# triggerRestart forwards the deployed numeric tag (not "latest") to
|
# triggerRestart forwards the deployed numeric tag (not "latest") to
|
||||||
# release-and-deploy, so the wrapper attempts recovery against ":1" rather
|
# release-and-deploy, so the wrapper attempts recovery against ":1" rather
|
||||||
# than skipping recovery for ":latest" which is never pushed.
|
# than skipping recovery for ":latest" which is never pushed.
|
||||||
assert_output_contains "dokku/$TEST_APP:1 not found locally, pulling from registry"
|
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
|
||||||
}
|
}
|
||||||
@@ -443,7 +443,7 @@ teardown() {
|
|||||||
echo "output: $output"
|
echo "output: $output"
|
||||||
echo "status: $status"
|
echo "status: $status"
|
||||||
assert_success
|
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" {
|
@test "(storage:migrate) leaves legacy-mounts-migrated unset for apps with no legacy -v lines" {
|
||||||
|
|||||||
Reference in new issue
Block a user