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

Proposed fix for ACR caching while providing guidance for GitLab users. #1628

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

wallyhall
Copy link

Proposed fix for #1620

This supersedes a single line change of PR #1283 ... and provides documentation (like already exists for ACR) to maintain GitLab compatibility (but the documented instructions have not been validated).

@welcome
Copy link

welcome bot commented Jan 23, 2023

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@wallyhall
Copy link
Author

Has anyone advice for testing this PR? The updated tests are largely all integration ... and I'm not entirely clear on the consequences of what I've changed with regards to other container registries (and I think that probably is why the original PR this seeks to "patch" probably wasn't caught for the ACR scenario I'm trying to repair here).

I've added an attempt at a regression test too, but I'm no Python wizard and I've been unable to get the tests running locally (I've relied on CI).

@wallyhall wallyhall marked this pull request as ready for review January 23, 2023 13:35
@leviplj
Copy link

leviplj commented Apr 4, 2023

Can any maintainer review/merge this? We've stuck with the same problem using ACR.

Thanks!

Copy link
Member

@manics manics left a comment

Choose a reason for hiding this comment

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

Sorry for the delay in reviewing. Over time the registry class has been incrementally modified to support other registries but unfortunately the documentation of how each registry works hasn't always been included, hence the difficulty in maintaining this code.

I think the best we can do is to ensure the existing tests pass unmodified (unless it's clear why the test needs to be changed), and to add more tests for new functionality or fixes as you've done.

"service": "service.1",
"scope": "scope.2",
},
),
Copy link
Member

Choose a reason for hiding this comment

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

Is this change needed?

@@ -196,6 +204,49 @@ async def test_get_token():
assert token == test_handle["token"]


async def test_get_token_with_config_supplied_service():
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this is a copy of test_get_token apart from the arguments to registry._get_token(). Can you use @pytest.mark.parametrize instead to reduce duplication?

@@ -230,7 +281,7 @@ async def test_get_image_manifest(tmpdir, token_url_known):
f,
)
if token_url_known:
token_url = url + "/token"
token_url = url + "/token?service=container_registry"
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed? If it's testing another scenario can you use @pytest.mark.parametrize to test with and without this extra parameter?

@bilke
Copy link

bilke commented Aug 21, 2024

I have setup BinderHub with ACR and in principal it works until the built image is downloaded where it fails with:

Failed to pull image "myacr.azurecr.io/...": failed to pull and unpack image: failed to resolve reference ... :
failed to authorize: failed to fetch anonymous token:
unexpected status from GET request to https://myacr.azurecr.io/oauth2/token?scope=repository%3Amyacracr%2Fmy-bilke-2dbinder-2dogs-2drequirements-d16279%3Apull&service=mybenacr.azurecr.io: 401 Unauthorized

I guess it is because of the issue described in #1620.

Is there a way to test this patch in my instance? I am a k8s / helm noobie so it would awesome could point out the required steps to test this, thanks a lot!

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.

4 participants