Teach the AWS Lambda to use the [minified]-platforms database
authorlforschler@apple.com <lforschler@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jul 2018 23:37:49 +0000 (23:37 +0000)
committerlforschler@apple.com <lforschler@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jul 2018 23:37:49 +0000 (23:37 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234016 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/WebKitArchiveSupport/lambda/register-archive-in-dynamodb.py
Tools/WebKitArchiveSupport/lambda/register-minified-s3-archive-in-dynamodb.py

index 200e4ba..f10cba1 100644 (file)
@@ -1,3 +1,15 @@
+2018-07-19  Lucas Forschler  <lforschler@apple.com>
+
+        Teach the AWS Lambda to use the [minified]-platforms database
+        https://bugs.webkit.org/show_bug.cgi?id=187817
+        
+        Reviewed by David Kilzer.
+
+        * WebKitArchiveSupport/lambda/register-archive-in-dynamodb.py:
+        (lambda_handler): Add support for the platforms.webkit.org database
+        * WebKitArchiveSupport/lambda/register-minified-s3-archive-in-dynamodb.py:
+        (lambda_handler): Add support for the minified-platforms.webkit.org database
+
 2018-07-19  Dean Jackson  <dino@apple.com>
 
         Provide an lldb type summary for WebCore::Color
index 0b4acad..949e8f0 100644 (file)
@@ -5,7 +5,8 @@ import urllib.parse  # pylint: disable=E0611
 
 DAYS_TO_KEEP = 14
 EPOCH_DAY = 86400
-TABLE_NAME = 'archives.webkit.org'
+ARCHIVE_TABLE_NAME = 'archives.webkit.org'
+PLATFORM_TABLE_NAME = 'platforms.webkit.org'
 URL_PREFIX = 'https://s3-us-west-2.amazonaws.com'
 
 dynamodb_client = boto3.client('dynamodb')
@@ -40,7 +41,16 @@ def lambda_handler(event, context):
             'expirationTime': {'N': expiration_time},
         }
         print('Item: {}'.format(item))
-        dynamodb_client.put_item(TableName=TABLE_NAME, Item=item)
+        dynamodb_client.put_item(TableName=ARCHIVE_TABLE_NAME, Item=item)
+
+        platform = {
+            'identifier': {'S': identifier},
+            'creationTime': {'N': creation_time},
+            'expirationTime': {'N': expiration_time},
+        }
+        print('Platform: {}'.format(platform))
+        dynamodb_client.put_item(TableName=PLATFORM_TABLE_NAME, Item=platform)
+
         return s3_url
     except Exception as e:
         print(e)
index c0be5d6..84cbee0 100644 (file)
@@ -5,7 +5,8 @@ import urllib.parse  # pylint: disable=E0611
 
 DAYS_TO_KEEP = 910
 EPOCH_DAY = 86400
-TABLE_NAME = 'minified-archives.webkit.org'
+ARCHIVE_TABLE_NAME = 'minified-archives.webkit.org'
+PLATFORM_TABLE_NAME = 'minified-platforms.webkit.org'
 URL_PREFIX = 'https://s3-us-west-2.amazonaws.com'
 
 dynamodb_client = boto3.client('dynamodb')
@@ -40,7 +41,16 @@ def lambda_handler(event, context):
             'expirationTime': {'N': expiration_time},
         }
         print('Item: {}'.format(item))
-        dynamodb_client.put_item(TableName=TABLE_NAME, Item=item)
+        dynamodb_client.put_item(TableName=ARCHIVE_TABLE_NAME, Item=item)
+
+        platform = {
+            'identifier': {'S': identifier},
+            'creationTime': {'N': creation_time},
+            'expirationTime': {'N': expiration_time},
+        }
+        print('Item: {}'.format(platform))
+        dynamodb_client.put_item(TableName=PLATFORM_TABLE_NAME, Item=platform)
+
         return s3_url
     except Exception as e:
         print(e)