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: only fallback to OCI image when current media type is OCI artifact #673

Merged
merged 6 commits into from
Nov 4, 2022

Conversation

qweeah
Copy link
Contributor

@qweeah qweeah commented Nov 4, 2022

Resolves #672

Signed-off-by: Billy Zha jinzha1@microsoft.com

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
cmd/oras/push.go Outdated Show resolved Hide resolved
cmd/oras/push.go Outdated
@@ -276,22 +276,25 @@ func pushArtifact(dst *remote.Repository, pack packFunc, packOpts *oras.PackOpti
return root, nil
}

func isArtifactUnsupported(err error) bool {
func noFallbackToOciImage(root ocispec.Descriptor, err error) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Making isArtifactUnsupported to noFallbackToOciImage might improve the readability of the invokers but make the readability of the implementation itself worse and easier to have bugs in it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you still have this concern after the refactoring?

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
cmd/oras/push.go Outdated Show resolved Hide resolved
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@codecov-commenter
Copy link

Codecov Report

Merging #673 (c2d413f) into main (990c84f) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #673   +/-   ##
=======================================
  Coverage   72.12%   72.12%           
=======================================
  Files          14       14           
  Lines         513      513           
=======================================
  Hits          370      370           
  Misses        114      114           
  Partials       29       29           

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

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

@qweeah qweeah changed the title style: improve code readability fix: only fallback to OCI image when current media type is OCI artifact Nov 4, 2022
Signed-off-by: Billy Zha <jinzha1@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 0348739 into oras-project:main Nov 4, 2022
TerryHowe pushed a commit to TerryHowe/oras that referenced this pull request Feb 2, 2023
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.

Check media type of manifest before fallback to OCI image for oras push and oras atatch
4 participants