-
Notifications
You must be signed in to change notification settings - Fork 390
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
#305 cleanup #416
#305 cleanup #416
Conversation
This breaks API, so tests are going to fail; corresponding skopeo PR is containers/skopeo#477 . |
d883d69
to
c4cdaa4
Compare
Now that inspectManifest only forwards the call to genericManifest.imageInspectInfo, simplify the call chain from {memoryImage,sourcedImage}.Inspect→inspectManifest→genericManifest.imageInspectInfo to genericManifest.Inspect directly (via embedding genericManifest into {memoryImage,sourcedImage}). Signed-off-by: Miloslav Trmač <[email protected]>
... instead of inventing a nonsensical value if the field is missing in OCI images. Signed-off-by: Miloslav Trmač <[email protected]>
The whole purpose of UnparsedImage is to not parse the manifest, so having this interface which more or less requires the manifest to be parsed and recomputed is not desirable. sourcedImage now uses ImageSource.LayerInfosForCopy via the private UnparsedImage.src, which is a bit ugly, but that dependency has already existed, and we get a more consistent public API for this price. Signed-off-by: Miloslav Trmač <[email protected]>
Signed-off-by: Miloslav Trmač <[email protected]>
Drop unused private fields in types used only for JSON marshaling. Use Schema2V1Image for the pre-1.8.3 reencoding, to mirror what docker/docker does. It is especially pointless to explicitly declare extra fields to preserve when the immediately following code removes all of them. Signed-off-by: Miloslav Trmač <[email protected]>
... which is what the API contract says it should do, at least. Signed-off-by: Miloslav Trmač <[email protected]>
…onversion Signed-off-by: Miloslav Trmač <[email protected]>
... to avoid confusion with image.manifestSchema1.convertToManifestSchema2 Signed-off-by: Miloslav Trmač <[email protected]>
... instead of reloading it in LayerInfosForCopy and getSize. Alternatively, it seems we could just save the TopLayer field; this is more generic. AFAICT this should be equally safe in principle: any locking done in the storage.Store loaders is unlocked by the time we get the *storage.Image, so if anything can modify the unlocked *storage.Image concurrently after this change, or make its fields invalid, the same breakage can in principle happen before this change just as well, "only" with a shorter window. Signed-off-by: Miloslav Trmač <[email protected]>
Signed-off-by: Miloslav Trmač <[email protected]>
Image.UpdatedImage is supposed to create a new instance which does not modify the original, so Manifest.UpdateLayerInfos should not modify the original either. Signed-off-by: Miloslav Trmač <[email protected]>
Not _quite_ comprehensive (notably not covering most failure cases), but at least comparable with the schema2 and OCI tests. Signed-off-by: Miloslav Trmač <[email protected]>
@runcom ping |
LGTM, @nalind please ack and I'll merge |
} | ||
if s1.Config != nil { | ||
i.Labels = s1.Config.Labels | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this leave i.Labels
set to nil
if the compat blob doesn't specify any labels?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“A nil
map is equivalent to an empty map except that no elements may be added.”, which seems acceptable here (and consistent with schema2).
One nit, otherwise LGTM. |
This is a set of quite independent cleanups and minor bug fixes on top of #305 . Notably resolves #413, and adds tests for the schema1 code to decrease risk of similar breakage in the future.
See individual commit messages for more details. I’ll be happy to break this up into several PRs if any part needs more discussion than others.
Cc: @nalind
types.Image.Inspect
call chainImageInspectInfo.Created
optionalLayerInfosForCopy
fromUnparsedImage
toImage
/sourcedImage
manifest.Schema1.Inspect
""
incomputeID
for unknown manifest typesmanifest.Schema1.ToSchema2
toToSchema2Config
*storage.Image
only once instorageImageSource
storageImageDestination.{image,systemContext}
Schema1.UpdateLayerInfos
image.manifestSchema1