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

fix: add empty check on blobs and manifest annotation #490

Merged
merged 11 commits into from
Aug 17, 2022

Conversation

jasminetMSFT
Copy link
Contributor

@jasminetMSFT jasminetMSFT commented Aug 11, 2022

Resolves #467
Signed-off-by: JasmineTang jasminetang@microsoft.com

cmd/oras/attach.go Outdated Show resolved Hide resolved
cmd/oras/attach.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.

Still need unit test for ValidateEmpty added in the pusher struct.

cmd/oras/internal/option/pusher.go Outdated Show resolved Hide resolved
cmd/oras/internal/option/pusher.go Outdated Show resolved Hide resolved
cmd/oras/internal/option/pusher.go Outdated Show resolved Hide resolved
Signed-off-by: JasmineTang <jasminetang@microsoft.com>
Signed-off-by: JasmineTang <jasminetang@microsoft.com>
Signed-off-by: JasmineTang <jasminetang@microsoft.com>
Signed-off-by: JasmineTang <jasminetang@microsoft.com>
Signed-off-by: JasmineTang <jasminetang@microsoft.com>
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

@shizhMSFT shizhMSFT added this to the v0.14.0 milestone Aug 15, 2022
Comment on lines 31 to 32
annotationConfig = "$config"
annotationManifest = "$manifest"
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make them public and update the references in cmd/oras/push.go.

Comment on lines 77 to 83
// ValidateEmpty checks whether blobs or manifest annotation are empty.
func (opts *Pusher) ValidateEmpty(args []string) error {
if len(args) == 1 && opts.ManifestAnnotations == "" {
return errors.New("no blob and manifest annotation are provided")
}
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic is attach specific. You might want to take it out of the Pusher option.

Signed-off-by: JasmineTang <jasminetang@microsoft.com>
Signed-off-by: JasmineTang <jasminetang@microsoft.com>
@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2022

Codecov Report

Merging #490 (c7cfae8) into main (9e1d11c) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #490   +/-   ##
=======================================
  Coverage   71.90%   71.90%           
=======================================
  Files           9        9           
  Lines         388      388           
=======================================
  Hits          279      279           
  Misses         87       87           
  Partials       22       22           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

cmd/oras/attach.go Outdated Show resolved Hide resolved
cmd/oras/internal/option/packer.go Outdated Show resolved Hide resolved
Signed-off-by: JasmineTang <jasminetang@microsoft.com>
Signed-off-by: JasmineTang <jasminetang@microsoft.com>
Signed-off-by: JasmineTang <jasminetang@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 4c786aa into oras-project:main Aug 17, 2022
TerryHowe pushed a commit to TerryHowe/oras that referenced this pull request Feb 2, 2023
Signed-off-by: JasmineTang <jasminetang@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.

attach should allow packing nil Blobs in the artifact manifest
4 participants