Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4e1dd27

Browse filesBrowse files
authored
Merge pull request python-gitlab#767 from python-gitlab/fix/744/delete_artifacts
feature: Implement artifacts deletion
2 parents e45a6e2 + 76b6e1f commit 4e1dd27
Copy full SHA for 4e1dd27

File tree

Expand file treeCollapse file tree

3 files changed

+21
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+21
-1
lines changed
Open diff view settings
Collapse file

‎docs/gl_objects/builds.rst‎

Copy file name to clipboardExpand all lines: docs/gl_objects/builds.rst
+4Lines changed: 4 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ Mark a job artifact as kept when expiration is set::
319319

320320
build_or_job.keep_artifacts()
321321

322+
Delete the artifacts of a job::
323+
324+
build_or_job.delete_artifacts()
325+
322326
Get a job trace::
323327

324328
build_or_job.trace()
Collapse file

‎gitlab/v4/objects.py‎

Copy file name to clipboardExpand all lines: gitlab/v4/objects.py
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,21 @@ def keep_artifacts(self, **kwargs):
15841584
path = "%s/%s/artifacts/keep" % (self.manager.path, self.get_id())
15851585
self.manager.gitlab.http_post(path)
15861586

1587+
@cli.register_custom_action("ProjectJob")
1588+
@exc.on_http_error(exc.GitlabCreateError)
1589+
def delete_artifacts(self, **kwargs):
1590+
"""Delete artifacts of a job.
1591+
1592+
Args:
1593+
**kwargs: Extra options to send to the server (e.g. sudo)
1594+
1595+
Raises:
1596+
GitlabAuthenticationError: If authentication is not correct
1597+
GitlabDeleteError: If the request could not be performed
1598+
"""
1599+
path = "%s/%s/artifacts" % (self.manager.path, self.get_id())
1600+
self.manager.gitlab.http_delete(path)
1601+
15871602
@cli.register_custom_action("ProjectJob")
15881603
@exc.on_http_error(exc.GitlabGetError)
15891604
def artifacts(self, streamed=False, action=None, chunk_size=1024, **kwargs):
Collapse file

‎tools/python_test_v4.py‎

Copy file name to clipboardExpand all lines: tools/python_test_v4.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,9 @@
421421

422422
# commit status
423423
commit = admin_project.commits.list()[0]
424+
size = len(commit.statuses.list())
424425
status = commit.statuses.create({"state": "success", "sha": commit.id})
425-
assert len(commit.statuses.list()) == 1
426+
assert len(commit.statuses.list()) == size + 1
426427

427428
assert commit.refs()
428429
assert commit.merge_requests() is not None

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.