-
Notifications
You must be signed in to change notification settings - Fork 90
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
Add examples for repository push, pull, resolve and tags #119
Conversation
70c27db
to
c203798
Compare
05270e8
to
dc5ef24
Compare
We will need examples for |
registry/remote/example_test.go
Outdated
if err != nil { | ||
panic(err) // Handle error | ||
} | ||
// If you want to play with your local registry, try to override |
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: Try using objective wording and try to avoid words like you, he, she, I, we.
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
* pack * fix pack * add pack test Signed-off-by: Lixia (Sylvia) Lei <lixia_lei@outlook.com> Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Sylvia Lei <lixlei@microsoft.com> Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Sajay Antony <sajaya@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>
…#117) 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: Lixia (Sylvia) Lei <lixia_lei@outlook.com> Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
* pack * fix pack * add pack test Signed-off-by: Lixia (Sylvia) Lei <lixia_lei@outlook.com>
Signed-off-by: Sajay Antony <sajaya@microsoft.com> Signed-off-by: Billy Zha <jinzha1@microsoft.com>
…#117) Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
You actually pulled a manifest.
Yeah but when querying remote registries, manifests and blobs go through different API endpoints. Just that functions like Repository.Fetch() automatically choose endpoints based on the media type.
No they can't. // Resolve resolves a reference to a manifest descriptor.
// See also `ManifestMediaTypes`.
func (r *Repository) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error) {
return r.Manifests().Resolve(ctx, reference)
} |
Yes you are right. Looks like I mixed Repository.Resolve with BlobStore.Resolve. I will separate blob pull and manifest pull. |
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@Wwwsylvia I separated examples for manifest and layer fetch and added new examples for manifes FetchReference. Please take a review when you got time, thanks |
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>
b3e3769
to
b19e08f
Compare
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>
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.
LGTM
registry/remote/example_test.go
Outdated
pulledBlob, err := io.ReadAll(rc) | ||
if err != nil { | ||
panic(err) | ||
} | ||
// verify the fetched content | ||
if descriptor.Digest != ocidigest.FromBytes(pulledBlob) || descriptor.Size != int64(len(pulledBlob)) { | ||
panic(err) | ||
} |
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.
Looks like we have lots of duplicated code like this.
@Wwwsylvia What do you think if we promote internal/ioutil.ReadAll() to the content
package?
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.
That would be useful.
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.
Issue created: #128
descriptor, err := repo.Resolve(ctx, digest) | ||
if err != nil { | ||
panic(err) | ||
} | ||
tag := "latest" | ||
err = repo.Tag(ctx, descriptor, tag) | ||
if err != nil { | ||
panic(err) | ||
} |
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.
@Wwwsylvia Resolve
and Tag
will have 3 requests in total. We probably need a more efficient one by having a generic Tag()
function by leveraging FetchReference()
and PushReference()
.
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.
Make sense.
Like func (r *Repository) ReTag(ctx context.Context, srcRef, destRef string) error
? Need to figure out a new function 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.
How about func Tag(ctx context.Context, repo Repository, srcRef, dstRef string) error
in package registry
?
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
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.
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
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.
LGTM
This PR works for item #60 and adds examples for:
Push & pull blobs
Tag a image
Resolve the tag
List tags in a repository