Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cog base layer hash #1833

Merged
merged 3 commits into from
Jul 26, 2024
Merged

Fix cog base layer hash #1833

merged 3 commits into from
Jul 26, 2024

Conversation

8W9aG
Copy link
Contributor

@8W9aG 8W9aG commented Jul 26, 2024

  • Fixes Cog docker labels for base images have incorrect hashes #1822
  • Adds a test case and develops against it, this test case creates a cog build, gets the labels from the docker image, and compares them against the layer hashes.
  • Issue was the previous code was fetching the manifest, then the layers from the manifest, and the digest from those layers, but this was the hash for the layer manifest rather than the layer itself.
  • Change to fetch layers rather than the manifest.
  • Use the DiffID of the layers which is the uncompressed hash, this corresponds to what is in the docker inspect for the layers.

8W9aG added 3 commits July 26, 2024 12:51
* Test that an image built with use-cog-base-image
gives a valid SHA hash reflected within its layers
* This currently fails, will be tested against to
determine that the fix is working correctly.
- Previously code was fetching the manifest, then
the layers from the manifest, then the digest of
those layers.
- This is actually the hash of the manifest but
not of the layer itself.
- What we actually want is the DiffID (the
uncompressed hash) of the layer.
Copy link
Contributor

@mattt mattt left a comment

Choose a reason for hiding this comment

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

Excellent! Thanks so much, @8W9aG.

@mattt mattt merged commit edaca59 into main Jul 26, 2024
12 checks passed
@mattt mattt deleted the fix-cog-base-layer-hash branch July 26, 2024 20:00
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.

Cog docker labels for base images have incorrect hashes
2 participants