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 fetching referrers error handling #1648

Merged

Conversation

otms61
Copy link
Contributor

@otms61 otms61 commented Apr 15, 2023

fixes #1647

I've fixed the error handling when fetching referrers in an OCI registry that does not support for referrers API.

The err returned before properly handling the exception when receiving a 404 error. I have fixed the code to ensure that the exception is handled correctly before returning.

When only the test part was modified, the test failed with the following error. Also, after modifying the code, the test passed successfully.

2023/04/14 12:43:50 GET /v2/
2023/04/14 12:43:50 GET /v2/repo/referrers/sha256:790f56f28e146a86b21b3ea65618fdf240ffc5d51e0b9948e31c284b41b2ed27 404 METHOD_UNKNOWN We don’t understand your method + url
2023/04/14 12:43:50 GET /v2/repo/manifests/sha256-790f56f28e146a86b21b3ea65618fdf240ffc5d51e0b9948e31c284b41b2ed27 404 MANIFEST_UNKNOWN Unknown manifest
--- FAIL: TestReferrers (0.01s)
    referrers_test.go:95: root image is sha256:790f56f28e146a86b21b3ea65618fdf240ffc5d51e0b9948e31c284b41b2ed27
    referrers_test.go:101: GET http://127.0.0.1:56527/v2/repo/manifests/sha256-790f56f28e146a86b21b3ea65618fdf240ffc5d51e0b9948e31c284b41b2ed27: MANIFEST_UNKNOWN: Unknown manifest
FAIL
FAIL    github.com/google/go-containerregistry/pkg/v1/remote    1.431s

Copy link
Collaborator

@jonjohnsonjr jonjohnsonjr left a comment

Choose a reason for hiding this comment

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

Thanks!

@jonjohnsonjr jonjohnsonjr merged commit bc990d6 into google:main Apr 17, 2023
@otms61 otms61 deleted the fix_fetching_referrers_error_handling branch April 18, 2023 00:02
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.

ggcr: remote.Referrers returns http not found error directly
2 participants