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