Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions docs/gl_objects/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ def __call__(self, chunk):
build.retry()
# end retry

# delete
gl.project_builds.delete(build_id, project_id=1)
# or
project.builds.delete(build_id)
# or
build.delete()
# end delete
# erase
build.erase()
# end erase
6 changes: 3 additions & 3 deletions docs/gl_objects/builds.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ Cancel/retry a build:
:start-after: # retry
:end-before: # end retry

Erase a build:
Erase a build (artifacts and trace):

.. literalinclude:: builds.py
:start-after: # delete
:end-before: # end delete
:start-after: # erase
:end-before: # end erase
4 changes: 4 additions & 0 deletions gitlab/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ class GitlabBuildRetryError(GitlabRetryError):
pass


class GitlabBuildEraseError(GitlabRetryError):
pass


class GitlabPipelineRetryError(GitlabRetryError):
pass

Expand Down
6 changes: 6 additions & 0 deletions gitlab/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,12 @@ def retry(self, **kwargs):
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.

Expand Down