diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2016-06-19 19:38:03 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2016-06-19 19:38:03 +0200 |
commit | 2e0ac3fa4a66a63921b2aeee81dcc942a0849985 (patch) | |
tree | fa40110d8bae77bd53d240e8f36fa9bcf5a0ba19 /gitlab/objects.py | |
parent | c85276a6e6c5088ea6f2ecb13059488c9779ea2c (diff) | |
parent | 80a190888028db4eb1df0c4f827938e89b20f8a1 (diff) | |
download | gitlab-2e0ac3fa4a66a63921b2aeee81dcc942a0849985.tar.gz |
Merge branch 'master' of github.com:gpocentek/python-gitlab
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r-- | gitlab/objects.py | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py index 41b8295..83569a0 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -822,18 +822,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 |