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: added warning for dangling referrers index deletion #619

Merged
merged 4 commits into from
Apr 13, 2023

Conversation

patrickzheng200
Copy link
Contributor

This PR tries to resolve #615.

Signed-off-by: Patrick Zheng <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Apr 6, 2023

Codecov Report

Merging #619 (ee4cb98) into main (0ec3b3d) will decrease coverage by 0.15%.
The diff coverage is 0.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #619      +/-   ##
==========================================
- Coverage   34.43%   34.28%   -0.15%     
==========================================
  Files          32       32              
  Lines        1844     1852       +8     
==========================================
  Hits          635      635              
- Misses       1188     1196       +8     
  Partials       21       21              
Impacted Files Coverage Δ
cmd/notation/sign.go 37.39% <0.00%> (-2.80%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

cmd/notation/sign.go Outdated Show resolved Hide resolved
@sajayantony
Copy link
Contributor

Should the exit code be zero? /cc @toddysm

@toddysm
Copy link
Contributor

toddysm commented Apr 6, 2023

@sajayantony I believe so and avoid braking any scripts.

Also, is this the only message we will show:

Warning: failed to delete dangling referrers index sha256:xxx for referrers tag sha256-1ba1561: DELETE "https://ghcr.io/v2/demo-user/python/manifests/sha256:e1b7d6": response status code 405: unsupported: The operation is unsupported.

I believe there should still be a confirmation that the operation succeeded and the signature got attached to the artifact. We should show the standard message we show when signature is attached + the warning.

@@ -22,6 +23,8 @@ const (
signatureManifestImage = "image"
)

const referrersTagSchemaDeleteError = "failed to delete dangling referrers index"
Copy link
Contributor

Choose a reason for hiding this comment

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

@shizhMSFT @Wwwsylvia Since this error is generated based on oras-go-specific procedure, should oras-go export this error so caller can implement upon?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's beyond this PR's scope, I created an issue for tracking, let's move discussion there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah we need to think about how to improve oras-go for such use case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Once oras-go is updated and have a new release, we can update here. But for now, let's do a string match.

@patrickzheng200
Copy link
Contributor Author

Should the exit code be zero? /cc @toddysm

Yes, the exit code should be 0. Once the warning is printed out, Successfully signed... is printed out and finally return nil.

@patrickzheng200
Copy link
Contributor Author

patrickzheng200 commented Apr 7, 2023

@sajayantony I believe so and avoid braking any scripts.

Also, is this the only message we will show:

Warning: failed to delete dangling referrers index sha256:xxx for referrers tag sha256-1ba1561: DELETE "https://ghcr.io/v2/demo-user/python/manifests/sha256:e1b7d6": response status code 405: unsupported: The operation is unsupported.

I believe there should still be a confirmation that the operation succeeded and the signature got attached to the artifact. We should show the standard message we show when signature is attached + the warning.

This warning message is an addition to the standard result. Can refer this in the code.

Signed-off-by: Patrick Zheng <[email protected]>
cmd/notation/sign.go Outdated Show resolved Hide resolved
@patrickzheng200 patrickzheng200 requested a review from qweeah April 7, 2023 07:28
@patrickzheng200
Copy link
Contributor Author

Closing this PR due to suggestion here: #615 (comment).
IMO, we should think through this process again before implementation.

@patrickzheng200
Copy link
Contributor Author

Reopened based on discussion.

Signed-off-by: Patrick Zheng <[email protected]>
Copy link
Contributor

@priteshbandi priteshbandi left a comment

Choose a reason for hiding this comment

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

LGTM

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 2841abe into notaryproject:main Apr 13, 2023
@patrickzheng200 patrickzheng200 deleted the fix branch April 13, 2023 04:18
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.

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