summaryrefslogtreecommitdiff
path: root/gitlab/objects.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2016-06-19 19:29:23 +0200
committerGitHub <noreply@github.com>2016-06-19 19:29:23 +0200
commit80a190888028db4eb1df0c4f827938e89b20f8a1 (patch)
tree198599f8ce7dd6ad35a26b03dab9900199e3a7c5 /gitlab/objects.py
parent412e2bc7e00a5229974388f795caefa1f0896273 (diff)
parentb3e0974451b49ab64866dc131bff59e5471ea620 (diff)
downloadgitlab-80a190888028db4eb1df0c4f827938e89b20f8a1.tar.gz
Merge pull request #125 from gpocentek/issue-122
Add support for build artifacts and trace
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r--gitlab/objects.py34
1 files changed, 32 insertions, 2 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py
index 7bba1c9..25cf10b 100644
--- a/gitlab/objects.py
+++ b/gitlab/objects.py
@@ -821,18 +821,48 @@ class ProjectBuild(GitlabObject):
canUpdate = False
canCreate = False
- def cancel(self):
+ def cancel(self, **kwargs):
"""Cancel the build."""
url = '/projects/%s/builds/%s/cancel' % (self.project_id, self.id)
r = self.gitlab._raw_post(url)
raise_error_from_response(r, GitlabBuildCancelError, 201)
- def retry(self):
+ def retry(self, **kwargs):
"""Retry the build."""
url = '/projects/%s/builds/%s/retry' % (self.project_id, self.id)
r = self.gitlab._raw_post(url)
raise_error_from_response(r, GitlabBuildRetryError, 201)
+ def artifacts(self, **kwargs):
+ """Get the build artifacts.
+
+ Returns:
+ str: The artifacts.
+
+ Raises:
+ GitlabConnectionError: If the server cannot be reached.
+ GitlabGetError: If the artifacts are not available.
+ """
+ url = '/projects/%s/builds/%s/artifacts' % (self.project_id, self.id)
+ r = self.gitlab._raw_get(url)
+ raise_error_from_response(r, GitlabGetError, 200)
+ return r.content
+
+ def trace(self, **kwargs):
+ """Get the build trace.
+
+ Returns:
+ str: The trace.
+
+ Raises:
+ GitlabConnectionError: If the server cannot be reached.
+ GitlabGetError: If the trace is not available.
+ """
+ url = '/projects/%s/builds/%s/trace' % (self.project_id, self.id)
+ r = self.gitlab._raw_get(url)
+ raise_error_from_response(r, GitlabGetError, 200)
+ return r.content
+
class ProjectBuildManager(BaseManager):
obj_cls = ProjectBuild