Closed karolz-ms closed 3 years ago
Hello @karolz-ms ! Thanks for filling this issue 👍 I checked it on my side, but I got the same results between the Hub-UI and a cURL request... Hub-UI:
cURL:
$ curl --request GET \
--url https://hub.docker.com/v2/repositories/namespaces/ \
--header 'Authorization: Bearer XXXXX.XXXXX.XXXXX' \
{"namespaces": ["composeonkubernetes", "dockerinternal", "kamoulox", "silvinorgtest", "slubecki"]}
But maybe I'm misunderstanding your point ? Can you add more context about what you get from hub-ui, and what you got by calling the API directly, and what you expect ? Thanks !
Silvin, good question, and sorry for stating the problem poorly.
I have the following setup:
zpkarolfriends
that has a repository hwflask
with one image: zpkarolfriends/hwflask:0.3
karolzms
that is part of zpkarolfriends
organizationWhen I log to Docker Hub website using karolzms
credentials, I can see the zpkarolfriends/hwflask
repository with no difficulty.
When I log in to Docker Hub from VS Code though, VS code issues a GET HTTP request with the path v2/repositories/namespaces?page_size=100
against GitHub API, no namespaces are returned. I tried the same query using curl
, with the same effect.
Hope this makes it clearer?
Yep that does thanks @karolz-ms we are able to reproduce and are looking into this further
Hey @karolz-ms 👋 we just deployed a fix for this issue. Any chance you can give it another go and see if it is indeed as expected on your end too? Thanks!
Hey @ruggi thanks for checking, but no, unfortunately I do not see the zpkarolfriends
organization returned from the namespaces query when I log as karolzms
user. Only karolzms
namespace is returned... 😞 So it is a change, but I still don't get from the query the organizational namespace I was hoping to see.
Please let me know if I can try something else?
Hello @karolz-ms, can I ask how you call the Docker Hub API? What is the authentication process you use (ie: Bearer token)?
@silvin-lubecki yes, bearer token. The relevant code is
(see loadMoreChildrenImpl
, signRequest
and refreshToken
functions in this file)
Hello @karolz-ms, I have a question after parsing your code. What is your intent when you query namespaces? If I understand it correctly, you want to display a tree view with all the organizations the user is part of, then all the repositories inside?
After re-checking our /namespaces
code, in the end it behaves as expected, ie: it returns all the organizations where you are an owner
. Can I suggest you to use the /v2/user/orgs/
endpoint instead, so you can list all the organizations ?
Happy to help you to migrate to the new endpoint if needed 👍
So v2/repositories/namespaces
is specifically for owners? If so we'll have to query /v2/user/orgs
as you suggest and merge it.
@karolz-ms can you add me to the zpkarolfriends
org and I can try these scenarios out?
@bwateratmsft done
Hello @karolz-ms , I can see you patched the code to use /v2/user/orgs
https://github.com/microsoft/vscode-docker/commit/f4ac5cd1e664244a89c1f4a5edb22463abc36c8e. Does that fix the issue? Can I close the ticket?
I think that would be fine, any objections @karolz-ms?
Yep, looks good, thanks @silvin-lubecki !
When querying Docker Hub via its REST API, the
v2/repositories/namespaces
query only returns namespaces associated with the Docker Hub login. The same query used by the Docker Hub site UI returns both namespaces associated with the login, as well as namespaces owned by all organizations that the user belongs to.Full repro steps (using VS Code) are available from related VS Code Docker extension issue