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

return success when force deleting a non-existent blob/manifest #722

Closed
qweeah opened this issue Dec 15, 2022 · 3 comments · Fixed by #745
Closed

return success when force deleting a non-existent blob/manifest #722

qweeah opened this issue Dec 15, 2022 · 3 comments · Fixed by #745
Labels
bug Something isn't working ux User experience related
Milestone

Comments

@qweeah
Copy link
Contributor

qweeah commented Dec 15, 2022

When force deleting via oras manifest/blob delete, if the target reference is not found in the remote registry, then user will see an error message like below:

$ oras blob delete localhost:5000/command/blob/delete/1671102430@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --force
Error: localhost:5000/command/blob/delete/1671102430@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: the specified blob does not exist

The returned value should indicate success if successfully resolving the reference and registry returns not found.

@FeynmanZhou

@qweeah qweeah added the ux User experience related label Dec 15, 2022
@qweeah qweeah changed the title return success when deleting a non-extent blob/manifest return success when deleting a non-existent blob/manifest Dec 15, 2022
@qweeah qweeah changed the title return success when deleting a non-existent blob/manifest return success when force deleting a non-existent blob/manifest Dec 15, 2022
@shizhMSFT shizhMSFT added the bug Something isn't working label Dec 15, 2022
@shizhMSFT
Copy link
Contributor

Here are the exit codes of the rm command for references.

$ rm not-exist
rm: cannot remove 'not-exist': No such file or directory
$ echo $?
1
$ rm -f not-exist
$ echo $?
0
$ rm /dev/null
rm: cannot remove '/dev/null': Permission denied
$ echo $?
1
$ rm -f /dev/null
rm: cannot remove '/dev/null': Permission denied
$ echo $?
1

@FeynmanZhou
Copy link
Member

Agree to change the return to success in the case above. How can we describe the output message exactly?

@qweeah
Copy link
Contributor Author

qweeah commented Jan 11, 2023

Taking manifest delete as an example, suppose $IMAGE is not existed:

  • oras manifest delete $IMAGE -f

    • return success since -f implies forced action
    • output Missing $IMAGE to stdout, this UX is consistent with deleting an existent manifest
  • oras manifest delete $IMAGE

    • fail and output Error: $IMAGE: the specified manifest does not exist to stderr
  • oras manifest delete $IMAGE -f --descriptor

    • fail since the to-be-deleted descriptor doesn't exist
    • output Error: $IMAGE: the specified manifest does not exist to stderr

shizhMSFT pushed a commit that referenced this issue Jan 12, 2023
Resolves #722 

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
qweeah added a commit to qweeah/oras that referenced this issue Jan 13, 2023
Resolves oras-project#722

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
TerryHowe pushed a commit to TerryHowe/oras that referenced this issue Feb 2, 2023
Resolves oras-project#722 

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ux User experience related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants