@@ -5122,6 +5122,40 @@ def transfer_project(self, to_namespace, **kwargs):
5122
5122
path , post_data = {"namespace" : to_namespace }, ** kwargs
5123
5123
)
5124
5124
5125
+ @cli .register_custom_action ("Project" , ("ref_name" , "job" ), ("job_token" ,))
5126
+ @exc .on_http_error (exc .GitlabGetError )
5127
+ def artifacts (
5128
+ self , ref_name , job , streamed = False , action = None , chunk_size = 1024 , ** kwargs
5129
+ ):
5130
+ """Get the job artifacts archive from a specific tag or branch.
5131
+
5132
+ Args:
5133
+ ref_name (str): Branch or tag name in repository. HEAD or SHA references
5134
+ are not supported.
5135
+ artifact_path (str): Path to a file inside the artifacts archive.
5136
+ job (str): The name of the job.
5137
+ job_token (str): Job token for multi-project pipeline triggers.
5138
+ streamed (bool): If True the data will be processed by chunks of
5139
+ `chunk_size` and each chunk is passed to `action` for
5140
+ treatment
5141
+ action (callable): Callable responsible of dealing with chunk of
5142
+ data
5143
+ chunk_size (int): Size of each chunk
5144
+ **kwargs: Extra options to send to the server (e.g. sudo)
5145
+
5146
+ Raises:
5147
+ GitlabAuthenticationError: If authentication is not correct
5148
+ GitlabGetError: If the artifacts could not be retrieved
5149
+
5150
+ Returns:
5151
+ str: The artifacts if `streamed` is False, None otherwise.
5152
+ """
5153
+ path = "/projects/%s/jobs/artifacts/%s/download" % (self .get_id (), ref_name )
5154
+ result = self .manager .gitlab .http_get (
5155
+ path , job = job , streamed = streamed , raw = True , ** kwargs
5156
+ )
5157
+ return utils .response_content (result , streamed , action , chunk_size )
5158
+
5125
5159
@cli .register_custom_action ("Project" , ("ref_name" , "artifact_path" , "job" ))
5126
5160
@exc .on_http_error (exc .GitlabGetError )
5127
5161
def artifact (
0 commit comments