-
Notifications
You must be signed in to change notification settings - Fork 212
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
Pass docker auth when retrieving bundle metadata #2366
Pass docker auth when retrieving bundle metadata #2366
Conversation
a05f8f0
to
4367243
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, that's such a subtle thing. Do you think we could add this discovery as a
comment above the change for the auth keychain in the code? I hope that will
help to explain why that code is needed in the future
Do you mean the part about what crane does by default vs go-container registry? |
When I first implemented this function, I used go-containerregistry instead of crane because I was returning more than just the digest. Now that the function only returns digest, I can just use crane. I've added another commit that re-implements the function using just crane. That way we don't need to explain the differences between how the two libraries authenticate. What do you think? |
d9ff9e7
to
d73d0d0
Compare
Before we publish or copy a bundle, we retrieve the destination bundle's metadata as a way to check if it already exists, and requires --force to overwrite. By default crane passes the current keychain when interacting with registries. Crane uses go-containerregistry under the hood and at the time I didn't realize that it was crane, and not go-containerregistry specifying the authentication. The go-containerregistry library authenticates as anonymous by default. So when a bundle was published to a new location, we would get a 401 auth error because authentication was not supplied, when we expected a 404 to tell that the bundle didn't exist at the destination location. I have updated the implementation of GetBundleMetadata to use crane for consistency and consolidated the set up of the crane options. Signed-off-by: Carolyn Van Slyck <[email protected]>
TestRegistry requires that the current user is logged into ghcr.io in order to test that we are passing authentication properly. Signed-off-by: Carolyn Van Slyck <[email protected]>
These tests are slow, speed them up! Signed-off-by: Carolyn Van Slyck <[email protected]>
f060cbe
to
b579f27
Compare
@VinozzZ I have updated the solution to use crane only. Can you take another look? |
Looks good to me |
What does this change
Before we publish or copy a bundle, we retrieve the destination bundle's metadata as a way to check if it already exists, and requires --force to overwrite. By default crane passes the current keychain when interacting with registries. Crane uses go-containerregistry under the hood and at the time I didn't realize that it was crane, and not go-containerregistry specifying the authentication. The go-containerregistry library authenticates as anonymous by default.
So when a bundle was published to a new location, we would get a 401 auth error because authentication was not supplied, when we expected a 404 to tell that the bundle didn't exist at the destination location. I have fixed our call to get the bundle metadata so that we pass in the keychain.
What issue does it fix
Closes #2365
Notes for the reviewer
N/A
Checklist
Reviewer Checklist