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

Improve the error msg for OCI v1.0 registries or registries that don't support deletion API #915

Closed
1 task
FeynmanZhou opened this issue Apr 4, 2023 · 4 comments · Fixed by #957
Closed
1 task
Assignees
Labels
bug Something isn't working ux User experience related
Milestone

Comments

@FeynmanZhou
Copy link
Member

FeynmanZhou commented Apr 4, 2023

What happened in your environment?

When using ORAS CLI to interact with OCI v1.0 compliant registries such as GHCR or registries that don't support deletion API (e.g. Docker Hub), ORAS will return an unexpected error message and may mislead or confuse users. It happens when attaching an artifact to the image for the second time.

What did you expect to happen?

Improve the error message to be more descriptive and user-friendly, and tell users about the right result exactly. Giving an example:

This artifact has been attached to `xxx`. 
Warning: Please note that ORAS can't delete the referrers index since this is an OCI v1.0 compliant registry or the Deletion API is disabled by the registry. 

How can we reproduce it?

I have attached a file to the sample Alpine image in GHCR. Then I attached another file to the same image and it returned the error message as follows:

oras attach --artifact-type=sbom/test ghcr.io/feynmanzhou/alpine:latest sbom.json -u feynmanzhou --password-stdin
Uploading 57761fa432ee sbom.json
Uploaded  57761fa432ee sbom.json
Error: failed to delete dangling referrers index sha256:de0b503017452ba6b070981414bfc31f8e6096852a36ff4f3223fdc0ff411566 for referrers tag sha256-1304f174557314a7ed9eddb4eab12fed12cb0cd9809e4c28f29af86979a3c870: DELETE "https://ghcr.io/v2/feynmanzhou/alpine/manifests/sha256:de0b503017452ba6b070981414bfc31f8e6096852a36ff4f3223fdc0ff411566": response status code 405: unsupported: The operation is unsupported.

It may confuse users why this attach behavior failed due to an old index manifest deletion failure. In fact, this file has been attached to the image successfully but it doesn't tell users the right result unless users verify it using oras discover as below.

oras discover ghcr.io/feynmanzhou/alpine:latest -o tree -u feynmanzhou --password-stdin
ghcr.io/feynmanzhou/alpine@sha256:1304f174557314a7ed9eddb4eab12fed12cb0cd9809e4c28f29af86979a3c870
├── application/vnd.cncf.notary.signature
│   └── sha256:85f65b60a6e260d52ba5f8d556d444320b92c2ac140ec8d4944dbd8b03deb18c
└── sbom/test
    └── sha256:ee375fb1111ca3d0c60663115e2cdce3e7061821ab26059852ecc43ceb8ee8cd

What is the version of your ORAS CLI?

Version:        1.0.0
Go version:     go1.20.2
Git commit:     b58e7b910ca556973d111e9bd734a71baef03db2
Git tree state: clean

What is your OS environment?

Ubuntu 20.08

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.
@FeynmanZhou FeynmanZhou added bug Something isn't working ux User experience related labels Apr 4, 2023
@qweeah qweeah self-assigned this Apr 7, 2023
@qweeah
Copy link
Contributor

qweeah commented May 17, 2023

The required handling not only needs to be added to oras attach, but also any operation that causes referrers change. I have applied the change to oras manifest push, oras manifest delete and oras cp

@qweeah
Copy link
Contributor

qweeah commented May 19, 2023

Found that this is not doable and relying on the completion of oras-project/oras-go#510

@qweeah
Copy link
Contributor

qweeah commented Jun 28, 2023

@FeynmanZhou Added information to guide user using the flag skip-delete-referrers to avoid this error in #957, can you help review the PR, thanks

@FeynmanZhou
Copy link
Member Author

FeynmanZhou commented Jul 5, 2023

@FeynmanZhou Added information to guide user using the flag skip-delete-referrers to avoid this error in #957, can you help review the PR, thanks

@qweeah Sorry for the late response. I double-checked the improved error message in your PR. It looks good to me.

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
3 participants