Skip to content

Commit

Permalink
Implement ProjectBuild.keep_artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauvain Pocentek committed Jul 17, 2016
1 parent b339ed9 commit e0cf1c2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion gitlab/objects.py
Expand Up @@ -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
Expand All @@ -876,6 +877,18 @@ def retry(self, **kwargs):
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.
Expand Down

0 comments on commit e0cf1c2

Please sign in to comment.