-
Notifications
You must be signed in to change notification settings - Fork 394
Reference abstraction #39
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
Conversation
This minimizes transport-specific knowledge in image name parsing (as in cmd/skopeo/utils.go) and allows separation of reference parsing and their use. Existing public NewImage... API has been removed; callers are expected to use any of * types.ImageTransport.ParseReference().NewImage... (if they have a general string) * transportpackage.ParseReference().NewImage... (if they have a transport-specific string) * transportpackage.NewReference().NewImage... (if they have transport-specific raw values) This usually adds an extra error checking step for the ParseReference/NewReference call compared to the previous code; this is considered not a big loss, especially because reporting “the reference is invalid” and “the reference looks valid but connecting/using it failed” as distinct failure modes seems quite useful for users. The references are currently one-way (you can get a types.Image* from an ImageReference, but not the other way around); that will be fixed soon. Signed-off-by: Miloslav Trmač <[email protected]>
This will consolidate Docker reference usage to all go through types.ImageReference. No users yet, will be migrated imminently. Signed-off-by: Miloslav Trmač <[email protected]>
This also removes the error return value, only supporting nil to indicate "Docker references not supported"; other kinds of errors should have been handled when initially parsing or creating the reference. Signed-off-by: Miloslav Trmač <[email protected]>
Signed-off-by: Miloslav Trmač <[email protected]>
This package maintains the list of all known transports, and provides helpers to convert between strings and types.ImageReference ; this should be the primary entrypoint for callers who want to just provide an UI without dealing with the underlying ImageReference structures or specific transports. This makes the skopeo/cmd/skopeo/utils.go transport:transport-specific string format a containers/image -defined feature. This would fit nicely into containers/image/image, but the individual transports depend on that package for creating a types.Image instance, so we would have a circular dependency. And containers/image/signature will need to depend on the list of transports maintained by this, so maintaining it at the top containers/image level would be a bad fit as well. So, sadly, another small subpackage. Though perhaps it should be called /reference instead of /transports? Either way, one half of the API will feel a bit off. Signed-off-by: Miloslav Trmač <[email protected]>
This allows the DockerReference-only refImageReferenceMock to be a bit tighter about rejecting unexpected calls, and it will be useful soon when policy is handled separately from DockerReference. At the moment this does not change much, separately commited primarily to ease reviewing. Signed-off-by: Miloslav Trmač <[email protected]>
This requires some new and expanded mocks instead of cheating and passing nil objects. Signed-off-by: Miloslav Trmač <[email protected]>
|
Marked as WIP because I need to re-integrate into mtrmac/image:integrate-all-the-things before being 100% certain, and a corresponding |
|
This is fairly test-heavy, especially considering how trivial some of the |
|
OK, full chain all the way to skopeo:integrate-all-the-things is updated and working, and this works with aka containers/skopeo#144 . Please review. |
| // (not as the image itself, or its underlying storage, claims). Should be fully expanded, i.e. !reference.IsNameOnly. | ||
| // This can be used e.g. to determine which public keys are trusted for this image. | ||
| // May be nil if unknown. | ||
| IntendedDockerReference() reference.Named |
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.
glad you remove those
This is split from #33 to make the review process a bit less overwhelming.
Introduces
types.ImageTransportandtypes.ImageReference, and reorganizes the code to work withImageReferencefor image identity.Does not change anything about the behavior, except for the last commit which takes advantage of the ability to get an
ImageReferencefrom atypes.Imageto improve some error messages.See individual commits for detailed description and rationale.