[ews-build] Download archives from S3
https://bugs.webkit.org/show_bug.cgi?id=197949

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/steps.py:
(DownloadBuiltProduct): Updated to use S3 URL.
(DownloadBuiltProduct.getResultSummary): Method to display custom failure string.
* BuildSlaveSupport/ews-build/steps_unittest.py: Updated unit-tests.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245433 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Tools/BuildSlaveSupport/ews-build/steps.py b/Tools/BuildSlaveSupport/ews-build/steps.py
index 6c10cd6..b9930ea 100644
--- a/Tools/BuildSlaveSupport/ews-build/steps.py
+++ b/Tools/BuildSlaveSupport/ews-build/steps.py
@@ -33,7 +33,7 @@
 import requests
 
 BUG_SERVER_URL = 'https://bugs.webkit.org/'
-EWS_URL = 'https://ews-build.webkit.org/'
+S3URL = 'https://s3-us-west-2.amazonaws.com/'
 WithProperties = properties.WithProperties
 Interpolate = properties.Interpolate
 
@@ -785,14 +785,19 @@
 
 class DownloadBuiltProduct(shell.ShellCommand):
     command = ['python', 'Tools/BuildSlaveSupport/download-built-product',
-        WithProperties('--platform=%(platform)s'), WithProperties('--%(configuration)s'),
-        WithProperties(EWS_URL + 'archives/%(fullPlatform)s-%(architecture)s-%(configuration)s/%(patch_id)s.zip')]
+        WithProperties('--%(configuration)s'),
+        WithProperties(S3URL + 'ews-archives.webkit.org/%(fullPlatform)s-%(architecture)s-%(configuration)s/%(patch_id)s.zip')]
     name = 'download-built-product'
     description = ['downloading built product']
     descriptionDone = ['Downloaded built product']
     haltOnFailure = True
     flunkOnFailure = True
 
+    def getResultSummary(self):
+        if self.results != SUCCESS:
+            return {u'step': u'Failed to download built product from S3'}
+        return super(DownloadBuiltProduct, self).getResultSummary()
+
 
 class ExtractBuiltProduct(shell.ShellCommand):
     command = ['python', 'Tools/BuildSlaveSupport/built-product-archive',
diff --git a/Tools/BuildSlaveSupport/ews-build/steps_unittest.py b/Tools/BuildSlaveSupport/ews-build/steps_unittest.py
index 10921c2..f1af68f 100644
--- a/Tools/BuildSlaveSupport/ews-build/steps_unittest.py
+++ b/Tools/BuildSlaveSupport/ews-build/steps_unittest.py
@@ -1007,14 +1007,13 @@
 
     def test_success(self):
         self.setupStep(DownloadBuiltProduct())
-        self.setProperty('platform', 'ios')
         self.setProperty('fullPlatform', 'ios-simulator-12')
         self.setProperty('configuration', 'release')
         self.setProperty('architecture', 'x86_64')
         self.setProperty('patch_id', '1234')
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
-                        command=['python', 'Tools/BuildSlaveSupport/download-built-product', '--platform=ios',  '--release', 'https://ews-build.webkit.org/archives/ios-simulator-12-x86_64-release/1234.zip'],
+                        command=['python', 'Tools/BuildSlaveSupport/download-built-product', '--release', 'https://s3-us-west-2.amazonaws.com/ews-archives.webkit.org/ios-simulator-12-x86_64-release/1234.zip'],
                         )
             + 0,
         )
@@ -1023,19 +1022,18 @@
 
     def test_failure(self):
         self.setupStep(DownloadBuiltProduct())
-        self.setProperty('platform', 'mac')
         self.setProperty('fullPlatform', 'mac-sierra')
         self.setProperty('configuration', 'debug')
         self.setProperty('architecture', 'x86_64')
         self.setProperty('patch_id', '123456')
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
-                        command=['python', 'Tools/BuildSlaveSupport/download-built-product', '--platform=mac',  '--debug', 'https://ews-build.webkit.org/archives/mac-sierra-x86_64-debug/123456.zip'],
+                        command=['python', 'Tools/BuildSlaveSupport/download-built-product', '--debug', 'https://s3-us-west-2.amazonaws.com/ews-archives.webkit.org/mac-sierra-x86_64-debug/123456.zip'],
                         )
             + ExpectShell.log('stdio', stdout='Unexpected failure.')
             + 2,
         )
-        self.expectOutcome(result=FAILURE, state_string='Downloaded built product (failure)')
+        self.expectOutcome(result=FAILURE, state_string='Failed to download built product from S3')
         return self.runStep()
 
 
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 0590e8a..6a7c88f 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,15 @@
+2019-05-16  Aakash Jain  <aakash_jain@apple.com>
+
+        [ews-build] Download archives from S3
+        https://bugs.webkit.org/show_bug.cgi?id=197949
+
+        Reviewed by Jonathan Bedard.
+
+        * BuildSlaveSupport/ews-build/steps.py:
+        (DownloadBuiltProduct): Updated to use S3 URL.
+        (DownloadBuiltProduct.getResultSummary): Method to display custom failure string.
+        * BuildSlaveSupport/ews-build/steps_unittest.py: Updated unit-tests.
+
 2019-05-16  David Kilzer  <ddkilzer@apple.com>
 
         REGRESSION (r15133): Fix leak of JSStringRef in minidom