@@ -385,14 +385,14 @@ def robosign_oci(args, s3, build, gpgkey):
385
385
# Upload them to S3. We upload to `staging/` first, and then will move
386
386
# them to their final location once they're verified.
387
387
sigstore_bucket , sigstore_prefix = get_bucket_and_prefix (args .s3_sigstore )
388
- sigstore_prefix = os .path .join (sigstore_prefix , 'staging' )
388
+ sigstore_staging = os .path .join (sigstore_prefix , 'staging' )
389
389
390
390
# First, empty out staging/ so we don't accumulate cruft over time
391
391
# https://stackoverflow.com/a/59026702
392
392
# Note this assumes we don't run in parallel on the same sigstore
393
393
# target, which is the case for us since only one release job can run at
394
394
# a time per-stream and the S3 target location is stream-based.
395
- staging_objects = s3 .list_objects_v2 (Bucket = sigstore_bucket , Prefix = sigstore_prefix )
395
+ staging_objects = s3 .list_objects_v2 (Bucket = sigstore_bucket , Prefix = sigstore_staging )
396
396
objects_to_delete = [{'Key' : obj ['Key' ]} for obj in staging_objects .get ('Contents' , [])]
397
397
if len (objects_to_delete ) > 0 :
398
398
print (f'Deleting { len (objects_to_delete )} stale files' )
@@ -401,7 +401,7 @@ def robosign_oci(args, s3, build, gpgkey):
401
401
# now, upload the ones we want
402
402
artifacts = []
403
403
for f in files_to_upload :
404
- s3_key = os .path .join (sigstore_prefix , f ['filename' ])
404
+ s3_key = os .path .join (sigstore_staging , f ['filename' ])
405
405
print (f"Uploading s3://{ sigstore_bucket } /{ s3_key } " )
406
406
s3 .upload_file (f ['path' ], sigstore_bucket , s3_key )
407
407
artifacts .append ({
@@ -435,10 +435,8 @@ def robosign_oci(args, s3, build, gpgkey):
435
435
gpg ('--quiet' , '--import' , gpgkey )
436
436
437
437
sig_counter = {}
438
- # peel off the '/staging' bit
439
- final_sigstore_prefix = os .path .dirname (sigstore_prefix )
440
438
for f in files_to_upload :
441
- stg_s3_key = os .path .join (sigstore_prefix , f ['filename' ])
439
+ stg_s3_key = os .path .join (sigstore_staging , f ['filename' ])
442
440
stg_sig_s3_key = stg_s3_key + '.sig'
443
441
444
442
tmp_sig_path = os .path .join (d , f ['filename' ] + '.sig' )
@@ -511,7 +509,7 @@ def robosign_oci(args, s3, build, gpgkey):
511
509
sig_counter [sig_prefix ] = sig_number
512
510
513
511
# upload to final location and make public
514
- final_s3_key = os .path .join (final_sigstore_prefix , sig_prefix , f"signature-{ sig_number } " )
512
+ final_s3_key = os .path .join (sigstore_prefix , sig_prefix , f"signature-{ sig_number } " )
515
513
print (f"Uploading { f ['path' ]} to s3://{ sigstore_bucket } /{ final_s3_key } " )
516
514
s3 .upload_file (f ['path' ], sigstore_bucket , final_s3_key , ExtraArgs = {'ACL' : 'public-read' })
517
515
0 commit comments