|
@ -1436,7 +1436,6 @@ export -f get_build_hash |
|
|
## |
|
|
## |
|
|
## Returns on stdout the name of the image if found, or an empty string if not |
|
|
## Returns on stdout the name of the image if found, or an empty string if not |
|
|
cache:image:registry:get() { |
|
|
cache:image:registry:get() { |
|
|
if [ -n "$COMPOSE_DOCKER_REGISTRY" ]; then |
|
|
|
|
|
local charm="$1" hash="$2" service="$3" |
|
|
local charm="$1" hash="$2" service="$3" |
|
|
local charm_image_name="cache/charm/$charm" |
|
|
local charm_image_name="cache/charm/$charm" |
|
|
local charm_image="$charm_image_name:$hash" |
|
|
local charm_image="$charm_image_name:$hash" |
|
@ -1454,12 +1453,12 @@ cache:image:registry:get() { |
|
|
printf "%s" "$charm_image" | tee "$cache_file" |
|
|
printf "%s" "$charm_image" | tee "$cache_file" |
|
|
return $? |
|
|
return $? |
|
|
fi |
|
|
fi |
|
|
if [[ "$out" != *"manifest unknown"* ]]; then |
|
|
|
|
|
|
|
|
if [[ "$out" != *"manifest unknown"* ]] && [[ "$out" != *"not found"* ]]; then |
|
|
print_status failure >&2 |
|
|
print_status failure >&2 |
|
|
Feed >&2 |
|
|
Feed >&2 |
|
|
err "Failed to pull image '$COMPOSE_DOCKER_REGISTRY/$charm_image'" \ |
|
|
err "Failed to pull image '$COMPOSE_DOCKER_REGISTRY/$charm_image'" \ |
|
|
"for ${DARKYELLOW}$service${NORMAL}:" |
|
|
"for ${DARKYELLOW}$service${NORMAL}:" |
|
|
e "$out" | prefix " ${GRAY}|${NORMAL} " >&2 |
|
|
|
|
|
|
|
|
e "$out"$'\n' | prefix " ${GRAY}|${NORMAL} " >&2 |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
print_info "not found" >&2 |
|
|
print_info "not found" >&2 |
|
@ -1471,7 +1470,6 @@ cache:image:registry:get() { |
|
|
echo -n "$*${NORMAL}" |
|
|
echo -n "$*${NORMAL}" |
|
|
fi >&2 |
|
|
fi >&2 |
|
|
Feed >&2 |
|
|
Feed >&2 |
|
|
fi |
|
|
|
|
|
} |
|
|
} |
|
|
export -f cache:image:registry:get |
|
|
export -f cache:image:registry:get |
|
|
|
|
|
|
|
@ -1636,7 +1634,7 @@ service_ensure_image_ready() { |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
## Can we pull it ? Let's check on $COMPOSE_DOCKER_REGISTRY |
|
|
## Can we pull it ? Let's check on $COMPOSE_DOCKER_REGISTRY |
|
|
|
|
|
|
|
|
|
|
|
if [ -n "$COMPOSE_DOCKER_REGISTRY" ]; then |
|
|
img=$(cache:image:registry:get "$charm" "$hash" "$service") || { |
|
|
img=$(cache:image:registry:get "$charm" "$hash" "$service") || { |
|
|
err "Failed to get image '$charm_image_name:$hash' from registry for ${DARKYELLOW}$service${NORMAL}." |
|
|
err "Failed to get image '$charm_image_name:$hash' from registry for ${DARKYELLOW}$service${NORMAL}." |
|
|
return 1 |
|
|
return 1 |
|
@ -1645,7 +1643,7 @@ service_ensure_image_ready() { |
|
|
printf "%s" "$img" | tee "$cache_file" |
|
|
printf "%s" "$img" | tee "$cache_file" |
|
|
return $? |
|
|
return $? |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fi |
|
|
cache:image:produce "$type" "$src" "$charm" "$hash" "$service" || return 1 |
|
|
cache:image:produce "$type" "$src" "$charm" "$hash" "$service" || return 1 |
|
|
cache:image:registry:put "$charm" "$hash" "$service" || return 1 |
|
|
cache:image:registry:put "$charm" "$hash" "$service" || return 1 |
|
|
printf "%s" "${charm_image_name}:$hash" | tee "$cache_file" |
|
|
printf "%s" "${charm_image_name}:$hash" | tee "$cache_file" |
|
|