Cleanup deploying image name retrieval
Rather than try to shim in the logic from the existing get_app_image_name method, simply duplicate it to make the method name more readable
This commit is contained in:
@@ -168,27 +168,21 @@ get_app_image_repo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_deploying_app_image_name() {
|
get_deploying_app_image_name() {
|
||||||
declare desc="return deployed image identifier for a given app, tag tuple. validate if tag is presented"
|
declare desc="return deploying image identifier for a given app, tag tuple. validate if tag is presented"
|
||||||
local APP="$1"; local IMAGE_TAG="$2";
|
local APP="$1"; local IMAGE_TAG="$2"; IMAGE_REPO="$3"
|
||||||
[[ -z "$APP" ]] && dokku_log_fail "(get_app_image_name) APP must not be null"
|
[[ -z "$APP" ]] && dokku_log_fail "(get_deploying_app_image_name) APP must not be null"
|
||||||
|
|
||||||
local IMAGE_REPO=""
|
|
||||||
local IMAGE_REMOTE_REPOSITORY=$(plugn trigger deployed-app-repository "$APP")
|
local IMAGE_REMOTE_REPOSITORY=$(plugn trigger deployed-app-repository "$APP")
|
||||||
local NEW_IMAGE_TAG=$(plugn trigger deployed-app-image-tag "$APP")
|
local NEW_IMAGE_TAG=$(plugn trigger deployed-app-image-tag "$APP")
|
||||||
local NEW_IMAGE_REPO=$(plugn trigger deployed-app-image-repo "$APP")
|
local NEW_IMAGE_REPO=$(plugn trigger deployed-app-image-repo "$APP")
|
||||||
|
|
||||||
if [[ -n "$NEW_IMAGE_TAG" ]]; then
|
[[ -n "$NEW_IMAGE_REPO" ]] && IMAGE_REPO="$NEW_IMAGE_REPO"
|
||||||
IMAGE_TAG="$NEW_IMAGE_TAG"
|
[[ -n "$NEW_IMAGE_TAG" ]] && IMAGE_TAG="$NEW_IMAGE_TAG"
|
||||||
fi
|
[[ -z "$IMAGE_REPO" ]] && IMAGE_REPO=$(get_app_image_repo "$APP")
|
||||||
|
[[ -z "$IMAGE_TAG" ]] && IMAGE_TAG="latest"
|
||||||
|
|
||||||
if [[ -n "$NEW_IMAGE_REPO" ]]; then
|
local IMAGE="${IMAGE_REMOTE_REPOSITORY}${IMAGE_REPO}:${IMAGE_TAG}"
|
||||||
IMAGE_REPO="$NEW_IMAGE_REPO"
|
verify_image "$IMAGE" || dokku_log_fail "app image ($IMAGE) not found"
|
||||||
fi
|
|
||||||
|
|
||||||
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG" "$IMAGE_REPO")
|
|
||||||
if [[ -n "$IMAGE_REMOTE_REPOSITORY" ]]; then
|
|
||||||
IMAGE="${IMAGE_REMOTE_REPOSITORY}${IMAGE}"
|
|
||||||
fi
|
|
||||||
echo "$IMAGE"
|
echo "$IMAGE"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,7 +379,7 @@ is_deployed() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
is_container_running () {
|
is_container_running() {
|
||||||
declare desc="return 0 if given docker container id is in running state"
|
declare desc="return 0 if given docker container id is in running state"
|
||||||
local CID=$1
|
local CID=$1
|
||||||
local CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" || true)
|
local CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" || true)
|
||||||
@@ -397,7 +391,7 @@ is_container_running () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
is_container_status () {
|
is_container_status() {
|
||||||
declare desc="return 0 if given docker container id is in given state"
|
declare desc="return 0 if given docker container id is in given state"
|
||||||
local CID=$1
|
local CID=$1
|
||||||
local TEMPLATE="{{.State.$2}}"
|
local TEMPLATE="{{.State.$2}}"
|
||||||
|
|||||||
Reference in New Issue
Block a user