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

Commitc01c034

Browse files
nejchJohnVillalovos
authored andcommitted
feat(artifacts): add support for project artifacts delete API
1 parent14b88a1 commitc01c034

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

‎gitlab/v4/objects/artifacts.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ def __call__(
4545
**kwargs,
4646
)
4747

48+
@exc.on_http_error(exc.GitlabDeleteError)
49+
defdelete(self,**kwargs:Any)->None:
50+
"""Delete the project's artifacts on the server.
51+
52+
Args:
53+
**kwargs: Extra options to send to the server (e.g. sudo)
54+
55+
Raises:
56+
GitlabAuthenticationError: If authentication is not correct
57+
GitlabDeleteError: If the server cannot perform the request
58+
"""
59+
path=self._compute_path("/projects/{project_id}/artifacts")
60+
61+
ifTYPE_CHECKING:
62+
assertpathisnotNone
63+
self.gitlab.http_delete(path,**kwargs)
64+
4865
@cli.register_custom_action(
4966
"ProjectArtifactManager", ("ref_name","job"), ("job_token",)
5067
)

‎tests/unit/objects/test_job_artifacts.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@ def resp_artifacts_by_ref_name(binary_content):
2424
yieldrsps
2525

2626

27+
@pytest.fixture
28+
defresp_project_artifacts_delete(no_content):
29+
withresponses.RequestsMock()asrsps:
30+
rsps.add(
31+
method=responses.DELETE,
32+
url="http://localhost/api/v4/projects/1/artifacts",
33+
json=no_content,
34+
content_type="application/json",
35+
status=204,
36+
)
37+
yieldrsps
38+
39+
40+
deftest_project_artifacts_delete(gl,resp_project_artifacts_delete):
41+
project=gl.projects.get(1,lazy=True)
42+
project.artifacts.delete()
43+
44+
2745
deftest_project_artifacts_download_by_ref_name(
2846
gl,binary_content,resp_artifacts_by_ref_name
2947
):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp