Skip to content

Commit 90134c9

Browse files
nejchJohnVillalovos
authored andcommitted
refactor(artifacts): remove deprecated artifact()in favor of artifacts.raw()
BREAKING CHANGE: The deprecated `project.artifact()` method is no longer available. Use `project.artifacts.raw()` instead.
1 parent 42639f3 commit 90134c9

File tree

4 files changed

+0
-53
lines changed

4 files changed

+0
-53
lines changed

docs/gl_objects/pipelines_and_jobs.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,6 @@ Get a single artifact file by branch and job::
300300

301301
project.artifacts.raw('branch', 'path/to/file', 'job')
302302

303-
.. attention::
304-
305-
An older method ``project.artifact()`` is deprecated and will be
306-
removed in a future version.
307-
308303
Mark a job artifact as kept when expiration is set::
309304

310305
build_or_job.keep_artifacts()

gitlab/v4/objects/projects.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -625,26 +625,6 @@ def transfer(self, to_namespace: Union[int, str], **kwargs: Any) -> None:
625625
path, post_data={"namespace": to_namespace}, **kwargs
626626
)
627627

628-
@cli.register_custom_action("Project", ("ref_name", "artifact_path", "job"))
629-
@exc.on_http_error(exc.GitlabGetError)
630-
def artifact(
631-
self,
632-
*args: Any,
633-
**kwargs: Any,
634-
) -> Optional[bytes]:
635-
utils.warn(
636-
message=(
637-
"The project.artifact() method is deprecated and will be "
638-
"removed in a future version. Use project.artifacts.raw() instead."
639-
),
640-
category=DeprecationWarning,
641-
)
642-
data = self.artifacts.raw(*args, **kwargs)
643-
if TYPE_CHECKING:
644-
assert data is not None
645-
assert isinstance(data, bytes)
646-
return data
647-
648628

649629
class ProjectManager(CRUDMixin, RESTManager):
650630
_path = "/projects"

tests/functional/cli/test_cli_artifacts.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -97,26 +97,3 @@ def test_cli_project_artifact_raw(gitlab_config, job_with_artifacts):
9797
artifacts = subprocess.run(cmd, capture_output=True, check=True)
9898
assert isinstance(artifacts.stdout, bytes)
9999
assert artifacts.stdout == b"test\n"
100-
101-
102-
def test_cli_project_artifact_warns_deprecated(gitlab_config, job_with_artifacts):
103-
cmd = [
104-
"gitlab",
105-
"--config-file",
106-
gitlab_config,
107-
"project",
108-
"artifact",
109-
"--id",
110-
str(job_with_artifacts.pipeline["project_id"]),
111-
"--ref-name",
112-
job_with_artifacts.ref,
113-
"--job",
114-
job_with_artifacts.name,
115-
"--artifact-path",
116-
"artifact.txt",
117-
]
118-
119-
artifacts = subprocess.run(cmd, capture_output=True, check=True)
120-
assert isinstance(artifacts.stdout, bytes)
121-
assert b"DeprecationWarning" in artifacts.stderr
122-
assert artifacts.stdout == b"test\n"

tests/unit/objects/test_projects.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -767,11 +767,6 @@ def test_transfer_project(project, resp_transfer_project):
767767
project.transfer("test-namespace")
768768

769769

770-
def test_artifact_project(project, resp_artifact):
771-
with pytest.warns(DeprecationWarning):
772-
project.artifact("ref_name", "artifact_path", "job")
773-
774-
775770
def test_project_pull_mirror(project, resp_start_pull_mirroring_project):
776771
project.mirror_pull()
777772

0 commit comments

Comments
 (0)