Browse Source

fix: [compose-core] prevent re-building images already present

Here, subordinate charms requested images using their names and not
their master's charm name. This would trigger builds of images already
present.
cache-relation
Valentin Lab 9 months ago
parent
commit
3a3a102459
  1. 8
      bin/compose-core

8
bin/compose-core

@ -1430,7 +1430,7 @@ service_base_docker_image() {
## According to https://stackoverflow.com/questions/32230577 , if there's a build,
## then the builded image will get name ${project}_${service}
project=$(get_default_project_name) || return 1
image_name="${project}_${service}"
image_name="${project}_${master_service}"
if ! docker_has_image "$image_name"; then
service_build=$(echo "$service_def" | shyaml get-value build 2>/dev/null)
if [ "$?" != 0 ]; then
@ -1439,12 +1439,12 @@ service_base_docker_image() {
return 1
fi
docker build "$service_build" -t "${project}_${service}" >&2 || {
err "Failed to build image for ${DARKYELLOW}$service${NORMAL}."
docker build "$service_build" -t "${image_name}" >&2 || {
err "Failed to build image '${image_name}' for ${DARKYELLOW}$service${NORMAL}."
return 1
}
fi
printf "%s" "${project}_${service}"
printf "%s" "${image_name}"
else
printf "%s" "${service_image}"
fi | tee "$cache_file"

Loading…
Cancel
Save