Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit76b6e1f

Browse files
author
Gauvain Pocentek
committed
feat: implement artifacts deletion
Closes#744
1 parente45a6e2 commit76b6e1f

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

‎docs/gl_objects/builds.rst

Lines changed: 4 additions & 0 deletions
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()

‎gitlab/v4/objects.py

Lines 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+
defdelete_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
defartifacts(self,streamed=False,action=None,chunk_size=1024,**kwargs):

‎tools/python_test_v4.py

Lines 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-
assertlen(commit.statuses.list())==1
426+
assertlen(commit.statuses.list())==size+1
426427

427428
assertcommit.refs()
428429
assertcommit.merge_requests()isnotNone

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp