Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit70148c6

Browse files
nejchJohnVillalovos
authored andcommitted
feat(groups): add support for group-level registry repositories
1 parentc84379d commit70148c6

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

‎docs/gl_objects/repositories.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Get the list of container registry repositories associated with the project::
2020

2121
repositories = project.repositories.list()
2222

23+
Get the list of all project container registry repositories in a group::
24+
25+
repositories = group.registry_repositories.list()
26+
2327
Delete repository::
2428

2529
project.repositories.delete(id=x)

‎gitlab/v4/objects/container_registry.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
fromgitlab.mixinsimportDeleteMixin,ListMixin,ObjectDeleteMixin,RetrieveMixin
77

88
__all__= [
9+
"GroupRegistryRepositoryManager",
910
"ProjectRegistryRepository",
1011
"ProjectRegistryRepositoryManager",
1112
"ProjectRegistryTag",
@@ -65,3 +66,9 @@ def get(
6566
self,id:Union[str,int],lazy:bool=False,**kwargs:Any
6667
)->ProjectRegistryTag:
6768
returncast(ProjectRegistryTag,super().get(id=id,lazy=lazy,**kwargs))
69+
70+
71+
classGroupRegistryRepositoryManager(ListMixin,RESTManager):
72+
_path="/groups/{group_id}/registry/repositories"
73+
_obj_cls=ProjectRegistryRepository
74+
_from_parent_attrs= {"group_id":"id"}

‎gitlab/v4/objects/groups.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from .badgesimportGroupBadgeManager# noqa: F401
1616
from .boardsimportGroupBoardManager# noqa: F401
1717
from .clustersimportGroupClusterManager# noqa: F401
18+
from .container_registryimportGroupRegistryRepositoryManager# noqa: F401
1819
from .custom_attributesimportGroupCustomAttributeManager# noqa: F401
1920
from .deploy_tokensimportGroupDeployTokenManager# noqa: F401
2021
from .epicsimportGroupEpicManager# noqa: F401
@@ -77,6 +78,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
7778
packages:GroupPackageManager
7879
projects:GroupProjectManager
7980
pushrules:GroupPushRulesManager
81+
registry_repositories:GroupRegistryRepositoryManager
8082
runners:GroupRunnerManager
8183
subgroups:"GroupSubgroupManager"
8284
variables:GroupVariableManager
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"""
2+
GitLab API: https://docs.gitlab.com/ee/api/container_registry.html
3+
"""
4+
importpytest
5+
importresponses
6+
7+
fromgitlab.v4.objectsimportProjectRegistryRepository
8+
9+
repositories_content= [
10+
{
11+
"id":1,
12+
"name":"",
13+
"path":"group/project",
14+
"project_id":9,
15+
"location":"gitlab.example.com:5000/group/project",
16+
"created_at":"2019-01-10T13:38:57.391Z",
17+
"cleanup_policy_started_at":"2020-01-10T15:40:57.391Z",
18+
},
19+
{
20+
"id":2,
21+
"name":"releases",
22+
"path":"group/project/releases",
23+
"project_id":9,
24+
"location":"gitlab.example.com:5000/group/project/releases",
25+
"created_at":"2019-01-10T13:39:08.229Z",
26+
"cleanup_policy_started_at":"2020-08-17T03:12:35.489Z",
27+
},
28+
]
29+
30+
31+
@pytest.fixture
32+
defresp_group_registry_repositories():
33+
withresponses.RequestsMock()asrsps:
34+
rsps.add(
35+
method=responses.GET,
36+
url="http://localhost/api/v4/groups/1/registry/repositories",
37+
json=repositories_content,
38+
content_type="application/json",
39+
status=200,
40+
)
41+
yieldrsps
42+
43+
44+
deftest_list_group_registry_repositories(group,resp_group_registry_repositories):
45+
repositories=group.registry_repositories.list()
46+
assertisinstance(repositories[0],ProjectRegistryRepository)
47+
assertrepositories[0].id==1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp