@@ -5087,6 +5087,40 @@ def transfer_project(self, to_namespace, **kwargs):
50875087 path , post_data = {"namespace" : to_namespace }, ** kwargs
50885088 )
50895089
5090+ @cli .register_custom_action ("Project" , ("ref_name" , "job" ), ("job_token" ,))
5091+ @exc .on_http_error (exc .GitlabGetError )
5092+ def artifacts (
5093+ self , ref_name , job , streamed = False , action = None , chunk_size = 1024 , ** kwargs
5094+ ):
5095+ """Get the job artifacts archive from a specific tag or branch.
5096+
5097+ Args:
5098+ ref_name (str): Branch or tag name in repository. HEAD or SHA references
5099+ are not supported.
5100+ artifact_path (str): Path to a file inside the artifacts archive.
5101+ job (str): The name of the job.
5102+ job_token (str): Job token for multi-project pipeline triggers.
5103+ streamed (bool): If True the data will be processed by chunks of
5104+ `chunk_size` and each chunk is passed to `action` for
5105+ treatment
5106+ action (callable): Callable responsible of dealing with chunk of
5107+ data
5108+ chunk_size (int): Size of each chunk
5109+ **kwargs: Extra options to send to the server (e.g. sudo)
5110+
5111+ Raises:
5112+ GitlabAuthenticationError: If authentication is not correct
5113+ GitlabGetError: If the artifacts could not be retrieved
5114+
5115+ Returns:
5116+ str: The artifacts if `streamed` is False, None otherwise.
5117+ """
5118+ path = "/projects/%s/jobs/artifacts/%s/download" % (self .get_id (), ref_name )
5119+ result = self .manager .gitlab .http_get (
5120+ path , job = job , streamed = streamed , raw = True , ** kwargs
5121+ )
5122+ return utils .response_content (result , streamed , action , chunk_size )
5123+
50905124 @cli .register_custom_action ("Project" , ("ref_name" , "artifact_path" , "job" ))
50915125 @exc .on_http_error (exc .GitlabGetError )
50925126 def artifact (
0 commit comments