diff options
Diffstat (limited to 'python/servo/package_commands.py')
-rw-r--r-- | python/servo/package_commands.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py index 9564e793b8c..2d7efcd13c3 100644 --- a/python/servo/package_commands.py +++ b/python/servo/package_commands.py @@ -633,7 +633,15 @@ class PackageCommands(CommandBase): aws_access_key_id=aws_access_key, aws_secret_access_key=aws_secret_access_key ) + + cloudfront = boto3.client( + 'cloudfront', + aws_access_key_id=aws_access_key, + aws_secret_access_key=aws_secret_access_key + ) + BUCKET = 'servo-builds2' + DISTRIBUTION_ID = 'EJ8ZWSJKFCJS2' nightly_dir = 'nightly/{}'.format(platform) filename = nightly_filename(package, timestamp) @@ -652,7 +660,7 @@ class PackageCommands(CommandBase): sha256_digest.update(data) package_hash = sha256_digest.hexdigest() package_hash_fileobj = io.BytesIO(package_hash.encode('utf-8')) - latest_hash_upload_key = '{}/servo-latest.{}.sha256'.format(nightly_dir, extension) + latest_hash_upload_key = f'{latest_upload_key}.sha256' s3.upload_file(package, BUCKET, package_upload_key) @@ -665,6 +673,21 @@ class PackageCommands(CommandBase): package_hash_fileobj, BUCKET, latest_hash_upload_key, ExtraArgs={'ContentType': 'text/plain'} ) + # Invalidate previous "latest" nightly files from + # CloudFront edge caches + cloudfront.create_invalidation( + DistributionId=DISTRIBUTION_ID, + InvalidationBatch={ + 'CallerReference': f'{latest_upload_key}-{timestamp}', + 'Paths': { + 'Quantity': 1, + 'Items': [ + f'/{latest_upload_key}*' + ] + } + } + ) + def update_maven(directory): (aws_access_key, aws_secret_access_key) = get_s3_secret() s3 = boto3.client( |