-
Notifications
You must be signed in to change notification settings - Fork 180
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
Refactor pull command #395
Conversation
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@shizhMSFT I have refactored the pull caching. It borrows the cas proxy implementation in oras-go, can we just make that package public? |
/cc @Wwwsylvia for inputs |
// option, see https://github.com/oras-project/oras-go/issues/59. | ||
func (t *PullTracker) Push(ctx context.Context, expected ocispec.Descriptor, content io.Reader) error { | ||
option := t.ManifestConfigOption | ||
if option != nil && option.MediaType == expected.MediaType && option.Name != "" { |
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.
Why do we check media type here? What if the media type does not match?
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.
Background: The manifest config option is set through the --manifest-config
flag, via which user can specify a file name and a media type for target config to be downloaded. If the media type is not provided, application/vnd.unknown.config.v1+json
will be used.
So here we should only rewrite the file name when a blob media type matches the target config media type. If the media type doesn't match, then current blob is not the target config blob.
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.
OK interesting. Maybe we can add some comments here?
cmd/oras/pull.go
Outdated
|
||
// Copy Options | ||
ctx, _ := opts.SetLoggerLevel() | ||
var dstStore = file.New(opts.Output) |
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.
nit: why not dstStore := file.New(opts.Output)
?
Agreed. Since it's common for clients to implement caching, I think we can promote the |
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Are we planning to support it and do due diligence? |
The biggest concern is that the current implementation of the proxy is only a read-through cache and what's deleted in the source won't reflected in the cache. I have added a new issue oras-project/oras-go#163 for it, we can move the discussion to the issue since the change is related to oras-go. |
|
Closing since the copy options are supported in oras-go and no need to hack status tracking. |
This PR upgrades pull command towards oras-go v2.
Resolves #325