Skip to content

Conversation

@cgwalters
Copy link
Collaborator

Different image references (imgrefs) pointing to the same digest should not share cached disk images, because the source imgref determines the upgrade source for the installed system.

Add the source_imgref field to the cache metadata structures and include it in the cache hash computation.

Additionally, add a --dry-run flag to to-disk that prints whether the disk would be regenerated (would-regenerate) or reused (would-reuse) without actually creating it. This is useful for testing and scripting.

Closes: #138

Assisted-by: Claude Code (Sonnet 4.5)

Different image references (imgrefs) pointing to the same digest should
not share cached disk images, because the source imgref determines the
upgrade source for the installed system.

Add the `source_imgref` field to the cache metadata structures
and include it in the cache hash computation.

Additionally, add a `--dry-run` flag to `to-disk` that prints whether the
disk would be regenerated (`would-regenerate`) or reused (`would-reuse`)
without actually creating it. This is useful for testing and scripting.

Closes: bootc-dev#138

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly addresses an issue with cache invalidation by including the source image reference in the cache hash. This prevents incorrect cache reuse when different tags point to the same image digest. The addition of the --dry-run flag is also a valuable feature for testing and scripting. The new integration test properly validates the fix. I have one suggestion to refactor a block of code to improve its clarity and maintainability.

@jeckersb jeckersb merged commit 84b02c2 into bootc-dev:main Nov 7, 2025
9 checks passed
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.

bcvk try to reuse existing cached disk when I change to a new image_ref but with the same digest

2 participants