Skip to content

Commit

Permalink
feature: Implement artifacts deletion
Browse files Browse the repository at this point in the history
Closes #744
  • Loading branch information
Gauvain Pocentek committed Jun 8, 2019
1 parent 794d64c commit af45502
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/gl_objects/builds.rst
Expand Up @@ -305,6 +305,10 @@ Mark a job artifact as kept when expiration is set::

build_or_job.keep_artifacts()

Delete the artifacts of a job::

build_or_job.delete_artifacts()

Get a job trace::

build_or_job.trace()
Expand Down
15 changes: 15 additions & 0 deletions gitlab/v4/objects.py
Expand Up @@ -1584,6 +1584,21 @@ def keep_artifacts(self, **kwargs):
path = "%s/%s/artifacts/keep" % (self.manager.path, self.get_id())
self.manager.gitlab.http_post(path)

@cli.register_custom_action("ProjectJob")
@exc.on_http_error(exc.GitlabCreateError)
def delete_artifacts(self, **kwargs):
"""Delete artifacts of a job?
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabDeleteError: If the request could not be performed
"""
path = "%s/%s/artifacts" % (self.manager.path, self.get_id())
self.manager.gitlab.http_delete(path)

@cli.register_custom_action("ProjectJob")
@exc.on_http_error(exc.GitlabGetError)
def artifacts(self, streamed=False, action=None, chunk_size=1024, **kwargs):
Expand Down

0 comments on commit af45502

Please sign in to comment.