-
Notifications
You must be signed in to change notification settings - Fork 644
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
List registry repository tags #2649
Comments
Hi @celalsahin! Please take a look at https://python-gitlab.readthedocs.io/en/stable/gl_objects/repository_tags.html. Looking at the page, not sure if the docs are 100% clear, but there should be enough info there. Just let us know and reopen if you think it's confusing! |
Hello @nejch I checked the documentation - thanks for the hint Currently I fetch all registry repos of a gitlab project via repositories = project.repositories.list() & loop through it to find the matching ID |
Ah, thanks for the clarification, I got a bit confused because you were referring to registry repository tags. So GitLab does not actually have a But the registry repository tags API uses the project-level style URL, so that cannot be reused. We could actually make this work by adding the GetMixin to our registry repository manager and you'd always do What we could do for convenience, is allow a kind of "lazy-only" option to our |
Thanks for the hint regarding the other endpoint, following its prints now I found: I can use the get method of this to get a registry repository given that I have its ID |
@celalsahin if you just need to retrieve the registry repository by ID, then that is enough, yes. But if you need to then list/manipulate the tags for it, unfortunately no, as that relies on the project-level endpoint. It's a consequence of how python-gitlab follows the GitLab API's URL scheme to structure parent/child resources. A similar problem is described in https://python-gitlab.readthedocs.io/en/stable/faq.html#i-cannot-edit-the-merge-request-issue-i-ve-just-retrieved. I have an idea to work around this limitation (see #1760 (comment)) but I've never gotten to it :) |
Ah I see - thanks for providing the answer even before my realization :) |
@nejch one of my colleagues corrected me that RegistryRepositoryManager will actually work with retrieving tags & it actually does repository = gitlab_api.registry_repositories.get(id=registry_repository_id, tags=True, get_all=True) When fetched like that it also fetches all tags - so at least from my point now I found the answer to my question, thanks :) |
Thanks @celalsahin! I'll keep this open to track the use case where users might also manipulate those tags. Also not sure if the array in the instance level response paginates well with many tag entries, but that's a nice and simple solution for now :) |
Thanks for the heads up - we will keep an eye on the pagination issue - for now some container registry with 929 tags worked fine - at least apparently more testing will follow :) |
Description of the problem, including code/CLI snippet
From the documentation I am not able to figure out finding the relevant method to match the API https://docs.gitlab.com/ee/api/container_registry.html#list-registry-repository-tags from gitlab.
What I can find is https://python-gitlab.readthedocs.io/en/stable/gl_objects/repositories.html which gets all registry repositories - not a single one, given that I have the container registry repository ID at hand.
"delete" method seems to take id= as parameter but same is missing for list method & there is no get method for project.repositories either.
Expected Behavior
A method is available to match https://docs.gitlab.com/ee/api/container_registry.html#list-registry-repository-tags
Actual Behavior
Not able to fetch a single container registry repository when we have the ID of the repository at hand.
Specifications
The text was updated successfully, but these errors were encountered: