Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions ci-automation/ci_automation_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,17 @@ function docker_image_from_buildcache() {
if [[ -n "${local_image}" ]] ; then
local image_id=""
image_id=$($docker image inspect "${local_image}" | jq -r '.[].Id' | sed 's/^sha256://')

local local_id_file="${name}-${version}.local-id"
if [[ -f "${local_id_file}" ]] ; then
local cached_id=""
cached_id=$(cat "${local_id_file}")
if [[ "${image_id}" = "${cached_id}" ]] ; then
echo "Local image is up-to-date (cached ID match)" >&2
return
fi
fi

local remote_id=""
remote_id=$(curl --fail --silent --show-error --location --retry-delay 1 \
--retry 60 --retry-connrefused --retry-max-time 60 --connect-timeout 20 \
Expand Down Expand Up @@ -270,6 +281,17 @@ function docker_image_from_buildcache() {
zstd -d -c ${tgz} | $docker load

rm "${tgz}"

local loaded_image=""
if image_exists_locally "${name}" "${version}" ; then
loaded_image="${name}:${version}"
elif image_exists_locally "${CONTAINER_REGISTRY}/${name}" "${version}" ; then
loaded_image="${CONTAINER_REGISTRY}/${name}:${version}"
fi
if [[ -n "${loaded_image}" ]] ; then
local local_id_file="${name}-${version}.local-id"
$docker image inspect "${loaded_image}" | jq -r '.[].Id' | sed 's/^sha256://' > "${local_id_file}"
fi
}
# --

Expand Down