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

Commitb3e0974

Browse files
author
Gauvain Pocentek
committed
Add support for build artifacts and trace
Fixes#122
1 parent422b163 commitb3e0974

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

‎gitlab/cli.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
gitlab.ProjectBranch: {'protect': {'required': ['id','project-id']},
3737
'unprotect': {'required': ['id','project-id']}},
3838
gitlab.ProjectBuild: {'cancel': {'required': ['id','project-id']},
39-
'retry': {'required': ['id','project-id']}},
39+
'retry': {'required': ['id','project-id']},
40+
'artifacts': {'required': ['id','project-id']},
41+
'trace': {'required': ['id','project-id']}},
4042
gitlab.ProjectCommit: {'diff': {'required': ['id','project-id']},
4143
'blob': {'required': ['id','project-id',
4244
'filepath']},
@@ -250,6 +252,20 @@ def do_project_build_retry(self, cls, gl, what, args):
250252
exceptExceptionase:
251253
_die("Impossible to retry project build (%s)"%str(e))
252254

255+
defdo_project_build_artifacts(self,cls,gl,what,args):
256+
try:
257+
o=self.do_get(cls,gl,what,args)
258+
returno.artifacts()
259+
exceptExceptionase:
260+
_die("Impossible to get project build artifacts (%s)"%str(e))
261+
262+
defdo_project_build_trace(self,cls,gl,what,args):
263+
try:
264+
o=self.do_get(cls,gl,what,args)
265+
returno.trace()
266+
exceptExceptionase:
267+
_die("Impossible to get project build trace (%s)"%str(e))
268+
253269
defdo_project_issue_subscribe(self,cls,gl,what,args):
254270
try:
255271
o=self.do_get(cls,gl,what,args)

‎gitlab/objects.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,18 +806,48 @@ class ProjectBuild(GitlabObject):
806806
canUpdate=False
807807
canCreate=False
808808

809-
defcancel(self):
809+
defcancel(self,**kwargs):
810810
"""Cancel the build."""
811811
url='/projects/%s/builds/%s/cancel'% (self.project_id,self.id)
812812
r=self.gitlab._raw_post(url)
813813
raise_error_from_response(r,GitlabBuildCancelError,201)
814814

815-
defretry(self):
815+
defretry(self,**kwargs):
816816
"""Retry the build."""
817817
url='/projects/%s/builds/%s/retry'% (self.project_id,self.id)
818818
r=self.gitlab._raw_post(url)
819819
raise_error_from_response(r,GitlabBuildRetryError,201)
820820

821+
defartifacts(self,**kwargs):
822+
"""Get the build artifacts.
823+
824+
Returns:
825+
str: The artifacts.
826+
827+
Raises:
828+
GitlabConnectionError: If the server cannot be reached.
829+
GitlabGetError: If the artifacts are not available.
830+
"""
831+
url='/projects/%s/builds/%s/artifacts'% (self.project_id,self.id)
832+
r=self.gitlab._raw_get(url)
833+
raise_error_from_response(r,GitlabGetError,200)
834+
returnr.content
835+
836+
deftrace(self,**kwargs):
837+
"""Get the build trace.
838+
839+
Returns:
840+
str: The trace.
841+
842+
Raises:
843+
GitlabConnectionError: If the server cannot be reached.
844+
GitlabGetError: If the trace is not available.
845+
"""
846+
url='/projects/%s/builds/%s/trace'% (self.project_id,self.id)
847+
r=self.gitlab._raw_get(url)
848+
raise_error_from_response(r,GitlabGetError,200)
849+
returnr.content
850+
821851

822852
classProjectBuildManager(BaseManager):
823853
obj_cls=ProjectBuild

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp