summaryrefslogtreecommitdiff
path: root/gitlab
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2016-07-17 13:11:48 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2016-07-17 13:11:48 +0200
commite0cf1c276d16ba9a0e26853e5ac94668a5b60818 (patch)
tree6164829b90210f5a9e8c18ae39d1c3642c570cfa /gitlab
parentb339ed98ee4981dd494096f73e5e8a8eb0b6116b (diff)
downloadgitlab-e0cf1c276d16ba9a0e26853e5ac94668a5b60818.tar.gz
Implement ProjectBuild.keep_artifacts
Diffstat (limited to 'gitlab')
-rw-r--r--gitlab/objects.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py
index a760a16..7d2b879 100644
--- a/gitlab/objects.py
+++ b/gitlab/objects.py
@@ -858,7 +858,8 @@ class ProjectBranchManager(BaseManager):
class ProjectBuild(GitlabObject):
_url = '/projects/%(project_id)s/builds'
_constructorTypes = {'user': 'User',
- 'commit': 'ProjectCommit'}
+ 'commit': 'ProjectCommit',
+ 'runner': 'Runner'}
requiredUrlAttrs = ['project_id']
canDelete = False
canUpdate = False
@@ -876,6 +877,18 @@ class ProjectBuild(GitlabObject):
r = self.gitlab._raw_post(url)
raise_error_from_response(r, GitlabBuildRetryError, 201)
+ def keep_artifacts(self, **kwargs):
+ """Prevent artifacts from being delete when expiration is set.
+
+ Raises:
+ GitlabConnectionError: If the server cannot be reached.
+ GitlabCreateError: If the request failed.
+ """
+ url = ('/projects/%s/builds/%s/artifacts/keep' %
+ (self.project_id, self.id))
+ r = self.gitlab._raw_post(url)
+ raise_error_from_response(r, GitlabGetError, 200)
+
def artifacts(self, **kwargs):
"""Get the build artifacts.