|
|
@ -1776,8 +1776,7 @@ service_ensure_image_ready() { |
|
|
|
local service="$1" \ |
|
|
|
cache_file="$CACHEDIR/$FUNCNAME.cache.$1.$(H "$COMBINED_HASH" "$(cat "$_CURRENT_DOCKER_COMPOSE")")" \ |
|
|
|
master_service service_def service_image service_build service_dockerfile image \ |
|
|
|
specified_image specified_image_id charm_image_name hash \ |
|
|
|
service_quoted |
|
|
|
specified_image specified_image_id charm_image_name hash |
|
|
|
|
|
|
|
if [ -e "$cache_file" ]; then |
|
|
|
#debug "$FUNCNAME: cache hit ($*)" |
|
|
@ -1812,7 +1811,6 @@ service_ensure_image_ready() { |
|
|
|
err "Could not get docker-compose service definition for $DARKYELLOW$service$NORMAL." |
|
|
|
return 1 |
|
|
|
} |
|
|
|
local service_quoted=${service//./\\.} |
|
|
|
if specified_image=$(e "$service_def" | shyaml get-value image 2>/dev/null); then |
|
|
|
if [[ "$specified_image" == "$charm_image_name:"* ]]; then |
|
|
|
## Assume we already did the change |
|
|
@ -1842,7 +1840,7 @@ service_ensure_image_ready() { |
|
|
|
type=fetch |
|
|
|
|
|
|
|
## replace image by charm image |
|
|
|
yq -i ".services.[\"${service_quoted}\"].image = \"${charm_image_name}:${hash}\"" \ |
|
|
|
yq -i ".services.[\"${service}\"].image = \"${charm_image_name}:${hash}\"" \ |
|
|
|
"$_CURRENT_DOCKER_COMPOSE" || return 1 |
|
|
|
else |
|
|
|
|
|
|
@ -1857,8 +1855,8 @@ service_ensure_image_ready() { |
|
|
|
hash=$(get_build_hash "$src") || return 1 |
|
|
|
type=build |
|
|
|
## delete build key from service_def and add image to charm_image_name |
|
|
|
yq -i "del(.services.[\"${service_quoted}\"].build) | |
|
|
|
.services.[\"${service_quoted}\"].image = \"${charm_image_name}:${hash}\"" \ |
|
|
|
yq -i "del(.services.[\"${service}\"].build) | |
|
|
|
.services.[\"${service}\"].image = \"${charm_image_name}:${hash}\"" \ |
|
|
|
"$_CURRENT_DOCKER_COMPOSE" || return 1 |
|
|
|
|
|
|
|
fi |
|
|
|