Skip to content
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

feat: support push a blob to a remote registry #489

Merged
merged 20 commits into from
Sep 13, 2022

Conversation

lizMSFT
Copy link
Contributor

@lizMSFT lizMSFT commented Aug 11, 2022

Add a command to push a blob to a remote registry

Resolves: #476
Signed-off-by: Zoey Li zoeyli@microsoft.com

@qweeah
Copy link
Contributor

qweeah commented Aug 11, 2022

Please mark the command blob and blob push preview. You may refer to other comamnds like attach or copy.

cmd/oras/blob/push.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
internal/upload/upload.go Outdated Show resolved Hide resolved
@lizMSFT lizMSFT force-pushed the liz/476 branch 4 times, most recently from 377b2e1 to 5e0ae90 Compare August 15, 2022 03:55
internal/file/file_test.go Outdated Show resolved Hide resolved
internal/file/file_test.go Outdated Show resolved Hide resolved
internal/file/file_test.go Outdated Show resolved Hide resolved
internal/file/file_test.go Show resolved Hide resolved
internal/file/file_test.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
internal/file/file.go Outdated Show resolved Hide resolved
internal/file/file_test.go Outdated Show resolved Hide resolved
internal/file/file_test.go Outdated Show resolved Hide resolved
internal/file/file_test.go Outdated Show resolved Hide resolved
internal/file/file_test.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
Copy link
Contributor

@qweeah qweeah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

cmd/oras/internal/option/output.go Outdated Show resolved Hide resolved
cmd/oras/internal/option/output.go Outdated Show resolved Hide resolved
cmd/oras/internal/option/output.go Outdated Show resolved Hide resolved
Copy link
Contributor

@qweeah qweeah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall implementation looks good.

cmd/oras/blob/push.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
cmd/oras/internal/option/descriptor.go Outdated Show resolved Hide resolved
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
internal/file/file.go Outdated Show resolved Hide resolved
internal/file/file_test.go Outdated Show resolved Hide resolved
lizMSFT and others added 2 commits September 8, 2022 23:14
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
internal/file/file.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
}

cmd.Flags().Int64VarP(&opts.size, "size", "", 0, "provide the blob size")
cmd.Flags().StringVarP(&opts.mediaType, "media-type", "", ocispec.MediaTypeImageLayer, "specify the returned media type in the descriptor if `--descriptor` is used")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FeynmanZhou @yizha1 What's the default media type for blobs? Currently, it is ocispec.MediaTypeImageLayer, which is consistent with oras push. We need to review it later.

internal/file/file.go Outdated Show resolved Hide resolved
cmd/oras/blob/push.go Outdated Show resolved Hide resolved
internal/file/file.go Outdated Show resolved Hide resolved
internal/file/file.go Show resolved Hide resolved
internal/file/file.go Show resolved Hide resolved
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
internal/file/file.go Outdated Show resolved Hide resolved
internal/file/file.go Outdated Show resolved Hide resolved
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
// prepares the content descriptor from stdin
if path == "-" {
// throw err if size or digest is not provided.
if size < 0 || dgst == "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that pushing a manifest doesn't require users to input its digest and size, because manifest has a small size and can be loaded into memory.

Preparing the content of the manifest can share the same part of reading from the file and generate the descriptor. After an offline discussion, I'll try to write a separate PrepareManifestContent() with unit tests.

@lizMSFT @shizhMSFT

Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shizhMSFT shizhMSFT merged commit b2c37a3 into oras-project:main Sep 13, 2022
TerryHowe pushed a commit to TerryHowe/oras that referenced this pull request Feb 2, 2023
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command to push a blob to a remote registry
9 participants