Skip to content

Commit 066e219

Browse files
authored
Merge pull request #145 from ligangty/main
Fix: use bucket name as prefix for manifest file storage
2 parents 2c02e85 + 8e9dba5 commit 066e219

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

charon/pkgs/maven.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def handle_maven_uploading(
307307
targets_ = [(target[1], remove_prefix(target[2], "/")) for target in targets]
308308
logger.info(
309309
"Start uploading files to s3 buckets: %s",
310-
[target[0] for target in targets_]
310+
[target[1] for target in targets_]
311311
)
312312
failed_files = s3_client.upload_files(
313313
file_paths=valid_mvn_paths,
@@ -325,7 +325,7 @@ def handle_maven_uploading(
325325
'uploading\n')
326326
else:
327327
logger.info("Start uploading manifest to s3 bucket %s", manifest_bucket_name)
328-
manifest_folder = target[0]
328+
manifest_folder = target[1]
329329
manifest_name, manifest_full_path = write_manifest(valid_mvn_paths, top_level, prod_key)
330330
s3_client.upload_manifest(
331331
manifest_name, manifest_full_path,
@@ -468,7 +468,7 @@ def handle_maven_del(
468468
logger.info("Files deletion done\n")
469469

470470
# 4. Delete related manifest from s3
471-
manifest_folder = target[0]
471+
manifest_folder = target[1]
472472
logger.info(
473473
"Start deleting manifest from s3 bucket %s in folder %s",
474474
manifest_bucket_name, manifest_folder

charon/pkgs/npm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def handle_npm_uploading(
100100
targets_ = [(target[1], remove_prefix(target[2], "/")) for target in targets]
101101
logger.info(
102102
"Start uploading files to s3 buckets: %s",
103-
[target[0] for target in targets_]
103+
[target[1] for target in targets_]
104104
)
105105
failed_files = client.upload_files(
106106
file_paths=valid_paths,
@@ -112,13 +112,13 @@ def handle_npm_uploading(
112112

113113
succeeded = True
114114
for target in targets:
115-
manifest_folder = target[0]
116115
if not manifest_bucket_name:
117116
logger.warning(
118117
'Warning: No manifest bucket is provided, will ignore the process of manifest '
119118
'uploading\n')
120119
else:
121120
logger.info("Start uploading manifest to s3 bucket %s", manifest_bucket_name)
121+
manifest_folder = target[1]
122122
manifest_name, manifest_full_path = write_manifest(valid_paths, target_dir, product)
123123
client.upload_manifest(
124124
manifest_name, manifest_full_path,
@@ -217,7 +217,7 @@ def handle_npm_del(
217217
logger.info("Files deletion done\n")
218218

219219
if manifest_bucket_name:
220-
manifest_folder = target[0]
220+
manifest_folder = target[1]
221221
logger.info(
222222
"Start deleting manifest from s3 bucket %s in folder %s",
223223
manifest_bucket_name, manifest_folder

charon/storage.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,7 @@ def upload_manifest(
418418
manifest_bucket_name: str
419419
):
420420
target = target if target else "default"
421-
env_folder = "-".join([target, "charon-metadata"])
422-
path_key = os.path.join(env_folder, manifest_name)
421+
path_key = os.path.join(target, manifest_name)
423422
manifest_bucket = self.__get_bucket(manifest_bucket_name)
424423
try:
425424
file_object: s3.Object = manifest_bucket.Object(path_key)
@@ -551,8 +550,7 @@ def delete_manifest(self, product_key: str, target: str, manifest_bucket_name: s
551550
return
552551
manifest_name = product_key + MANIFEST_SUFFIX
553552
target = target if target else "default"
554-
env_folder = "-".join([target, "charon-metadata"])
555-
path_key = os.path.join(env_folder, manifest_name)
553+
path_key = os.path.join(target, manifest_name)
556554

557555
manifest_bucket = self.__get_bucket(manifest_bucket_name)
558556
file_object: s3.Object = manifest_bucket.Object(path_key)

tests/commons.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@
118118
# For manifest
119119
TEST_MANIFEST_BUCKET = "test_manifest_bucket"
120120
TEST_TARGET = "stage"
121-
COMMONS_CLIENT_456_MANIFEST = "stage-charon-metadata/commons-client-4.5.6.txt"
122-
CODE_FRAME_7_14_5_MANIFEST = "stage-charon-metadata/code-frame-7.14.5.txt"
121+
COMMONS_CLIENT_456_MANIFEST = TEST_BUCKET + "/commons-client-4.5.6.txt"
122+
CODE_FRAME_7_14_5_MANIFEST = TEST_BUCKET + "/code-frame-7.14.5.txt"
123123

124124
# For multi targets support
125125
TEST_BUCKET_2 = "test_bucket_2"

0 commit comments

Comments
 (0)