summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gitlab/exceptions.py4
-rw-r--r--gitlab/objects.py6
2 files changed, 10 insertions, 0 deletions
diff --git a/gitlab/exceptions.py b/gitlab/exceptions.py
index 7b0f7f0..0fc8617 100644
--- a/gitlab/exceptions.py
+++ b/gitlab/exceptions.py
@@ -95,6 +95,10 @@ class GitlabBuildRetryError(GitlabRetryError):
pass
+class GitlabBuildEraseError(GitlabRetryError):
+ pass
+
+
class GitlabPipelineRetryError(GitlabRetryError):
pass
diff --git a/gitlab/objects.py b/gitlab/objects.py
index 8821633..2609e1b 100644
--- a/gitlab/objects.py
+++ b/gitlab/objects.py
@@ -961,6 +961,12 @@ class ProjectBuild(GitlabObject):
r = self.gitlab._raw_post(url)
raise_error_from_response(r, GitlabBuildRetryError, 201)
+ def erase(self, **kwargs):
+ """Erase the build (remove build artifacts and trace)."""
+ url = '/projects/%s/builds/%s/erase' % (self.project_id, self.id)
+ r = self.gitlab._raw_post(url)
+ raise_error_from_response(r, GitlabBuildEraseError, 201)
+
def keep_artifacts(self, **kwargs):
"""Prevent artifacts from being delete when expiration is set.