@@ -256,12 +256,11 @@ def handle_maven_uploading(
256256 prod_key : str ,
257257 ignore_patterns = None ,
258258 root = "maven-repository" ,
259- targets : List [Tuple [str , str ]] = None ,
259+ targets : List [Tuple [str , str , str ]] = None ,
260260 aws_profile = None ,
261261 dir_ = None ,
262262 do_index = True ,
263263 dry_run = False ,
264- manifest_folder = None ,
265264 manifest_bucket_name = None
266265) -> Tuple [str , bool ]:
267266 """ Handle the maven product release tarball uploading process.
@@ -273,9 +272,9 @@ def handle_maven_uploading(
273272 need to upload in the tarball
274273 * root is a prefix in the tarball to identify which path is
275274 the beginning of the maven GAV path
276- * target is the a tuple of s3 bucket name and prefix for the bucket,
277- whic will be used to store artifacts with the prefix. See target
278- definition in Charon configuration for details
275+ * targets contains the target name with its bucket name and prefix
276+ for the bucket, which will be used to store artifacts with the
277+ prefix. See target definition in Charon configuration for details
279278 * dir_ is base dir for extracting the tarball, will use system
280279 tmp dir if None.
281280
@@ -305,39 +304,40 @@ def handle_maven_uploading(
305304 # Question: should we exit here?
306305
307306 main_target = targets [0 ]
308- main_target_prefix = remove_prefix (main_target [1 ], "/" )
307+ main_bucket_prefix = remove_prefix (main_target [2 ], "/" )
309308 succeeded = True
310309 # 4. Do uploading
311310 logger .info ("Start uploading files to s3" )
312311 s3_client = S3Client (aws_profile = aws_profile , dry_run = dry_run )
313- bucket = main_target [0 ]
312+ bucket = main_target [1 ]
314313 failed_files = s3_client .upload_files (
315314 file_paths = valid_mvn_paths ,
316- target = (bucket , main_target_prefix ),
315+ target = (bucket , main_bucket_prefix ),
317316 product = prod_key ,
318317 root = top_level
319318 )
320319 logger .info ("Files uploading done\n " )
321320
322- # 5. Do manifest uploading
323- logger .info ("Start uploading manifest to s3" )
324- if not manifest_bucket_name :
325- logger .warning (
326- 'Warning: No manifest bucket is provided, will ignore the process of manifest '
327- 'uploading\n ' )
328- else :
329- manifest_name , manifest_full_path = write_manifest (valid_mvn_paths , top_level , prod_key )
330- s3_client .upload_manifest (
331- manifest_name , manifest_full_path ,
332- manifest_folder , manifest_bucket_name
333- )
334- logger .info ("Manifest uploading is done\n " )
335-
336- # 6. Use uploaded poms to scan s3 for metadata refreshment
337321 all_failed_metas : Dict [str , List [str ]] = {}
338322 for target in targets :
339- bucket_ = target [0 ]
340- prefix__ = remove_prefix (target [1 ], "/" )
323+ # 5. Do manifest uploading
324+ logger .info ("Start uploading manifest to s3" )
325+ manifest_folder = target [0 ]
326+ if not manifest_bucket_name :
327+ logger .warning (
328+ 'Warning: No manifest bucket is provided, will ignore the process of manifest '
329+ 'uploading\n ' )
330+ else :
331+ manifest_name , manifest_full_path = write_manifest (valid_mvn_paths , top_level , prod_key )
332+ s3_client .upload_manifest (
333+ manifest_name , manifest_full_path ,
334+ manifest_folder , manifest_bucket_name
335+ )
336+ logger .info ("Manifest uploading is done\n " )
337+
338+ # 6. Use uploaded poms to scan s3 for metadata refreshment
339+ bucket_ = target [1 ]
340+ prefix__ = remove_prefix (target [2 ], "/" )
341341 failed_metas = []
342342 logger .info ("Start generating maven-metadata.xml files for bucket %s" , bucket_ )
343343 meta_files = _generate_metadatas (
@@ -421,12 +421,11 @@ def handle_maven_del(
421421 prod_key : str ,
422422 ignore_patterns = None ,
423423 root = "maven-repository" ,
424- targets : Tuple [str , str ] = None ,
424+ targets : List [ Tuple [str , str , str ] ] = None ,
425425 aws_profile = None ,
426426 dir_ = None ,
427427 do_index = True ,
428428 dry_run = False ,
429- manifest_folder = None ,
430429 manifest_bucket_name = None
431430) -> Tuple [str , bool ]:
432431 """ Handle the maven product release tarball deletion process.
@@ -458,10 +457,10 @@ def handle_maven_del(
458457 logger .debug ("Valid poms: %s" , valid_poms )
459458 succeeded = True
460459 for target in targets :
461- prefix_ = remove_prefix (target [1 ], "/" )
460+ prefix_ = remove_prefix (target [2 ], "/" )
462461 logger .info ("Start deleting files from s3" )
463462 s3_client = S3Client (aws_profile = aws_profile , dry_run = dry_run )
464- bucket = target [0 ]
463+ bucket = target [1 ]
465464 (_ , failed_files ) = s3_client .delete_files (
466465 valid_mvn_paths ,
467466 target = (bucket , prefix_ ),
@@ -471,6 +470,7 @@ def handle_maven_del(
471470 logger .info ("Files deletion done\n " )
472471
473472 # 4. Delete related manifest from s3
473+ manifest_folder = target [0 ]
474474 logger .info ("Start deleting manifest from s3" )
475475 s3_client .delete_manifest (prod_key , manifest_folder , manifest_bucket_name )
476476 logger .info ("Manifest deletion is done\n " )
0 commit comments