Title: [219240] trunk/Tools
Revision
219240
Author
lforsch...@apple.com
Date
2017-07-06 22:10:38 -0700 (Thu, 06 Jul 2017)

Log Message

Enabling uploading archives to S3.
https://bugs.webkit.org/show_bug.cgi?id=174198
        
Reviewed by Stephanie Lewis.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(ArchiveMinifiedBuiltProduct): Create a minified archive from a full archive
(UploadMinifiedBuiltProduct): Upload minified archive to build master
(TransferToS3): Transfer full and minified archives to S3

Modified Paths

Added Paths

Diff

Added: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/transfer-archive-to-s3 (0 => 219240)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/transfer-archive-to-s3	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/transfer-archive-to-s3	2017-07-07 05:10:38 UTC (rev 219240)
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+import argparse
+import boto3
+import os
+import os.path
+import sys
+
+S3_BUCKET = 'archives.webkit.org'
+S3_MINIFIED_BUCKET = 'minified-archives.webkit.org'
+S3_REGION_PREFIX = 'https://s3-us-west-2.amazonaws.com'
+
+def uploadToS3(archive_path, bucket, identifier, revision):
+    print 'Transferring {} to S3...'.format(archive_path)
+    key = '/'.join([identifier, revision + '.zip'])
+    print '\tS3 Bucket: {}\n\tS3 Key: {}'.format(bucket, key)
+    s3.upload_file(archive_path, bucket, key)
+    print('\tS3 URL: {}/{}/{}'.format(S3_REGION_PREFIX, bucket, key))
+
+def archiveExists(archive):
+    if archive:
+        if os.path.exists(archive):
+	        return True
+        else:
+            print 'WARNING: Archive does not exist: {}'.format(archive)
+            return False
+	
+parser = argparse.ArgumentParser(add_help=True)
+parser.add_argument('--revision', action="" required=True, help='Revision number for the built archive')
+parser.add_argument('--identifier', action="" required=True, help='S3 destination identifier, in the form of fullPlatform-architecture-configuration. [mac-sierra-x86_64-release]')
+parser.add_argument('--archive', action="" required=True, help='Path to the full size archive. [path/to/123456.zip]')
+args = parser.parse_args()
+
+
+head, tail = os.path.split(str(args.archive))
+minifiedArchive = head + '/minified-' + tail
+s3 = boto3.client('s3')
+
+if archiveExists(args.archive):
+    uploadToS3(args.archive, S3_BUCKET, args.identifier, args.revision)
+if archiveExists(minifiedArchive):
+    uploadToS3(minifiedArchive, S3_MINIFIED_BUCKET, args.identifier, args.revision)
\ No newline at end of file

Modified: trunk/Tools/ChangeLog (219239 => 219240)


--- trunk/Tools/ChangeLog	2017-07-07 05:08:22 UTC (rev 219239)
+++ trunk/Tools/ChangeLog	2017-07-07 05:10:38 UTC (rev 219240)
@@ -1,3 +1,15 @@
+2017-07-06  Lucas Forschler  <lforsch...@apple.com>
+
+        Enabling uploading archives to S3.
+        https://bugs.webkit.org/show_bug.cgi?id=174198
+        
+        Reviewed by Stephanie Lewis.
+
+        * BuildSlaveSupport/build.webkit.org-config/master.cfg:
+        (ArchiveMinifiedBuiltProduct): Create a minified archive from a full archive
+        (UploadMinifiedBuiltProduct): Upload minified archive to build master
+        (TransferToS3): Transfer full and minified archives to S3
+
 2017-07-05  Yusuke Suzuki  <utatane....@gmail.com>
 
         [WTF] Implement WTF::ThreadGroup
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to