Title: [245359] trunk/Tools
Revision
245359
Author
[email protected]
Date
2019-05-15 15:21:24 -0700 (Wed, 15 May 2019)

Log Message

[ews-build] Enabling uploading EWS archives to S3
https://bugs.webkit.org/show_bug.cgi?id=197914

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/Shared: Added.
* BuildSlaveSupport/Shared/transfer-archive-to-s3: Moved from Tools/BuildSlaveSupport/build.webkit.org-config/transfer-archive-to-s3.
(archiveExists): Replace tab with space.
(main): Added main method.
* BuildSlaveSupport/build.webkit.org-config/steps.py:
(TransferToS3): Updated path to the script.
* BuildSlaveSupport/build.webkit.org-config/transfer-archive-to-s3: Moved to Shared folder.

Modified Paths

Added Paths

Removed Paths

Diff

Copied: trunk/Tools/BuildSlaveSupport/Shared/transfer-archive-to-s3 (from rev 245358, trunk/Tools/BuildSlaveSupport/build.webkit.org-config/transfer-archive-to-s3) (0 => 245359)


--- trunk/Tools/BuildSlaveSupport/Shared/transfer-archive-to-s3	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/Shared/transfer-archive-to-s3	2019-05-15 22:21:24 UTC (rev 245359)
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+import argparse
+import boto3
+import os
+import sys
+
+S3_DEFAULT_BUCKET = 'archives.webkit.org'
+S3_EWS_BUCKET = 'ews-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 = boto3.client('s3')
+    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
+
+def main():
+    parser = argparse.ArgumentParser(add_help=True)
+
+    group = parser.add_mutually_exclusive_group(required=True)
+    group.add_argument('--revision', action="" help='Revision number or patch_id for the built archive')
+    group.add_argument('--patch_id', action="" help='patch_id of the patch')
+
+    parser.add_argument('--identifier', action="" required=True, help='S3 destination identifier, in the form of fullPlatform-architecture-configuration. [mac-mojave-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()
+
+    parentdir, filename = os.path.split(str(args.archive))
+    minifiedArchive = os.path.join(parentdir, 'minified-' + filename)
+
+    s3_bucket = S3_DEFAULT_BUCKET
+    if args.patch_id:
+        s3_bucket = S3_EWS_BUCKET
+
+    if archiveExists(args.archive):
+        uploadToS3(args.archive, s3_bucket, args.identifier, args.revision or args.patch_id)
+    if not args.patch_id and archiveExists(minifiedArchive):
+        uploadToS3(minifiedArchive, S3_MINIFIED_BUCKET, args.identifier, args.revision)
+
+if __name__ == "__main__":
+    main()

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/steps.py (245358 => 245359)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/steps.py	2019-05-15 22:15:49 UTC (rev 245358)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/steps.py	2019-05-15 22:21:24 UTC (rev 245359)
@@ -874,7 +874,7 @@
     minifiedArchive = WithProperties("archives/%(fullPlatform)s-%(architecture)s-%(configuration)s/minified-%(got_revision)s.zip")
     identifier = WithProperties("%(fullPlatform)s-%(architecture)s-%(configuration)s")
     revision = WithProperties("%(got_revision)s")
-    command = ["python", "./transfer-archive-to-s3", "--revision", revision, "--identifier", identifier, "--archive", archive]
+    command = ["python", "../Shared/transfer-archive-to-s3", "--revision", revision, "--identifier", identifier, "--archive", archive]
     haltOnFailure = True
 
     def __init__(self, **kwargs):

Deleted: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/transfer-archive-to-s3 (245358 => 245359)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/transfer-archive-to-s3	2019-05-15 22:15:49 UTC (rev 245358)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/transfer-archive-to-s3	2019-05-15 22:21:24 UTC (rev 245359)
@@ -1,41 +0,0 @@
-#!/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 (245358 => 245359)


--- trunk/Tools/ChangeLog	2019-05-15 22:15:49 UTC (rev 245358)
+++ trunk/Tools/ChangeLog	2019-05-15 22:21:24 UTC (rev 245359)
@@ -1,3 +1,18 @@
+2019-05-15  Aakash Jain  <[email protected]>
+
+        [ews-build] Enabling uploading EWS archives to S3
+        https://bugs.webkit.org/show_bug.cgi?id=197914
+
+        Reviewed by Jonathan Bedard.
+
+        * BuildSlaveSupport/Shared: Added.
+        * BuildSlaveSupport/Shared/transfer-archive-to-s3: Moved from Tools/BuildSlaveSupport/build.webkit.org-config/transfer-archive-to-s3.
+        (archiveExists): Replace tab with space.
+        (main): Added main method.
+        * BuildSlaveSupport/build.webkit.org-config/steps.py:
+        (TransferToS3): Updated path to the script.
+        * BuildSlaveSupport/build.webkit.org-config/transfer-archive-to-s3: Moved to Shared folder.
+
 2019-05-15  Wenson Hsieh  <[email protected]>
 
         inputmode="numeric" should show a number pad with digits 0-9, instead of the numeric keyplane
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to