crane/flatten: preserve image media type when flattening#2267
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2267 +/- ##
==========================================
+ Coverage 53.08% 56.82% +3.74%
==========================================
Files 166 166
Lines 11275 11279 +4
==========================================
+ Hits 5985 6409 +424
+ Misses 4567 4103 -464
- Partials 723 767 +44 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
You have included the changes from adding the Delete scope in this pull request. Please remove them. |
Carry the original image's media type (OCI vs Docker) through to the flattened image so that an OCI image index does not end up referencing Docker-typed image manifests (and vice versa). Registries and tooling that assume an index and its children share the same media-type family reject the mixed result. Signed-off-by: Ali <alliasgher123@gmail.com>
121dd4f to
7d0adee
Compare
|
Apologies — the branch was mistakenly stacked on top of the Delete-scope branch (#2266). Force-pushed a clean rebuild from |
|
Looks good! Could you add some test coverage for the change? |
Verifies that flattenImage carries the source image's media type (OCI or Docker) through to the flattened image. Fails against the pre-fix code for OCI inputs and passes for Docker. Signed-off-by: Ali <alliasgher123@gmail.com>
|
Thanks @Subserial — added |
|
@Subserial @alliasgher Thanks a lot for this fix, any ETA on the new release? |
* crane/flatten: preserve image media type when flattening Carry the original image's media type (OCI vs Docker) through to the flattened image so that an OCI image index does not end up referencing Docker-typed image manifests (and vice versa). Registries and tooling that assume an index and its children share the same media-type family reject the mixed result. Signed-off-by: Ali <alliasgher123@gmail.com> * crane/flatten: add media type preservation test Verifies that flattenImage carries the source image's media type (OCI or Docker) through to the flattened image. Fails against the pre-fix code for OCI inputs and passes for Docker. Signed-off-by: Ali <alliasgher123@gmail.com>
Fixes #2203. flattenImage always created images from empty.Image (Docker media type). For OCI images, this produced mixed-type indexes. Apply mutate.MediaType to inherit the original image's media type, matching what flattenIndex already does for the index.