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

Commitf90cde9

Browse files
feat: add Project CI Lint support
Add support for validating a project's CI configuration [1]TODO: Add docs[1]https://docs.gitlab.com/ee/api/lint.html#validate-a-projects-ci-configuration
1 parent85a734f commitf90cde9

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

‎gitlab/v4/objects/projects.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
"""
2+
GitLab API:
3+
https://docs.gitlab.com/ee/api/projects.html
4+
https://docs.gitlab.com/ee/api/lint.html#validate-a-projects-ci-configuration
5+
"""
16
fromtypingimportAny,Callable,cast,Dict,List,Optional,TYPE_CHECKING,Union
27

38
importrequests
@@ -9,6 +14,7 @@
914
fromgitlab.mixinsimport (
1015
CreateMixin,
1116
CRUDMixin,
17+
GetWithoutIdMixin,
1218
ListMixin,
1319
ObjectDeleteMixin,
1420
RefreshMixin,
@@ -80,6 +86,8 @@
8086
"ProjectForkManager",
8187
"ProjectRemoteMirror",
8288
"ProjectRemoteMirrorManager",
89+
"ProjectCiLint",
90+
"ProjectCiLintManager",
8391
]
8492

8593

@@ -141,6 +149,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
141149
badges:ProjectBadgeManager
142150
boards:ProjectBoardManager
143151
branches:ProjectBranchManager
152+
ci_lint:"ProjectCiLintManager"
144153
clusters:ProjectClusterManager
145154
commits:ProjectCommitManager
146155
customattributes:ProjectCustomAttributeManager
@@ -1013,3 +1022,27 @@ class ProjectRemoteMirrorManager(ListMixin, CreateMixin, UpdateMixin, RESTManage
10131022
required=("url",),optional=("enabled","only_protected_branches")
10141023
)
10151024
_update_attrs=RequiredOptional(optional=("enabled","only_protected_branches"))
1025+
1026+
1027+
classProjectCiLint(RESTObject):
1028+
pass
1029+
1030+
1031+
classProjectCiLintManager(GetWithoutIdMixin,RESTManager):
1032+
_path="/projects/{project_id}/ci/lint"
1033+
_obj_cls=ProjectCiLint
1034+
_from_parent_attrs= {"project_id":"id"}
1035+
# https://docs.gitlab.com/ee/api/lint.html#validate-a-projects-ci-configuration
1036+
1037+
defget(
1038+
self,id:Optional[Union[int,str]]=None,**kwargs:Any
1039+
)->Optional[ProjectCiLint]:
1040+
ifidisnotNone:
1041+
raiseAttributeError("Unsupported attribute: id")
1042+
1043+
ifTYPE_CHECKING:
1044+
assertself.pathisnotNone
1045+
server_data=self.gitlab.http_get(self.path,**kwargs)
1046+
ifTYPE_CHECKING:
1047+
assertisinstance(server_data,dict)
1048+
returnself._obj_cls(self,server_data)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp