Skip to content

ci: cache loaded image ID to prevent redundant SDK downloads - #4171

Open
satwiksps wants to merge 1 commit into
flatcar:mainfrom
satwiksps:image-id-inconsistent
Open

ci: cache loaded image ID to prevent redundant SDK downloads#4171
satwiksps wants to merge 1 commit into
flatcar:mainfrom
satwiksps:image-id-inconsistent

Conversation

@satwiksps

Copy link
Copy Markdown

docker_image_from_buildcache() compares the local image ID against the .id file hosted on bincache.flatcar-linux.net, this .id file is generated at build time from docker image inspect in CI. But a docker save / docker load round-trip can produce a different image ID on the consumer's Docker daemon (e.g., due to different Docker versions or storage drivers between CI and the developer's machine). So the ID comparison always fails, and run_sdk_container -t re-downloads the multi-GB SDK tarball on every single invocation even when the local image is perfectly valid.

what I did in this PR is after a successful docker load, cache the actual loaded image ID to a local <name>-<version>.local-id file. on subsequent runs, docker_image_from_buildcache() checks this local cache first, if current image ID matches the cached ID, the image is considered up-to-date and the download is skipped. existing remote .id comparison is preserved as a fallback for environments where the save/load round-trip is stable like when CI and the developer use the same Docker version

The remote .id file on bincache is generated from `docker image inspect`
during CI at build time but `docker save` followed by `docker load` on
a different Docker daemon produce a different image ID for the same
image content. This causes `docker_image_from_buildcache()` to consider
locally loaded image as "outdated" every invocation, triggering
redundant multi-GB tarball download each time `run_sdk_container -t`
is run.

Caching the actual image ID produced by `docker load` into a local
`.local-id` file. On subsequent runs, compare against the cached ID
first before falling back to the remote .id file.

Fixes flatcar/Flatcar#2086

Signed-off-by: Satwik Sai Prakash Sahoo <sahoospsatwik@gmail.com>
@satwiksps
satwiksps requested a review from a team as a code owner August 2, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker image and its id show inconsistent image id in bincache

1 participant