Title: [250784] trunk/Tools
Revision
250784
Author
jbed...@apple.com
Date
2019-10-07 13:07:33 -0700 (Mon, 07 Oct 2019)

Log Message

results.webkit.org: Start reporting results
https://bugs.webkit.org/show_bug.cgi?id=202639

Reviewed by Dewei Zhu.

* BuildSlaveSupport/build.webkit.org-config/loadConfig.py:
(loadBuilderConfig): Load API key for results.webkit.org.
* BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py:
(create_mock_slave_passwords_dict): Add mock for API key.
* BuildSlaveSupport/build.webkit.org-config/steps.py:
(RunWebKitTests): Start reporting to results.webkit.org.
(RunWebKitTests.__init__): Do not print the environment to hide the API key.
(RunWebKitTests.start): Add the API key to the environment.
(RunAPITests): Start reporting to results.webkit.org.
(RunAPITests.__init__): Do not print the environment to hide the API key.
(RunAPITests.start): Add the API key to the environment.
(RunPythonTests): Start reporting to results.webkit.org.
(RunPythonTests.__init__): Do not print the environment to hide the API key.
(RunPythonTests.start): Add the API key to the environment.
* Scripts/webkitpy/results/upload.py:
(Upload):
(Upload.upload): Add API_KEY, if it exists, to the request.
(Upload.upload_archive): Ditto.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/loadConfig.py (250783 => 250784)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/loadConfig.py	2019-10-07 19:22:17 UTC (rev 250783)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/loadConfig.py	2019-10-07 20:07:33 UTC (rev 250784)
@@ -49,8 +49,11 @@
         passwords = make_passwords_json.create_mock_slave_passwords_dict()
     else:
         passwords = json.load(open('passwords.json'))
+    results_server_api_key = passwords.get('results-server-api-key')
+    if results_server_api_key:
+        os.environ['RESULTS_SERVER_API_KEY'] = results_server_api_key
+
     config = json.load(open('config.json'))
-
     c['slaves'] = [BuildSlave(slave['name'], passwords[slave['name']], max_builds=1) for slave in config['slaves']]
 
     c['schedulers'] = []

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py (250783 => 250784)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py	2019-10-07 19:22:17 UTC (rev 250783)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py	2019-10-07 20:07:33 UTC (rev 250784)
@@ -31,7 +31,9 @@
 def create_mock_slave_passwords_dict():
     with open('config.json', 'r') as config_json:
         config_dict = json.load(config_json)
-    return dict([(slave['name'], '1234') for slave in config_dict['slaves']])
+    result = dict([(slave['name'], '1234') for slave in config_dict['slaves']])
+    result['results-server-api-key'] = 'api-key'
+    return result
 
 if __name__ == '__main__':
     with open('passwords.json', 'w') as passwords_file:

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


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/steps.py	2019-10-07 19:22:17 UTC (rev 250783)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/steps.py	2019-10-07 20:07:33 UTC (rev 250784)
@@ -35,6 +35,8 @@
 APPLE_WEBKIT_AWS_PROXY = "http://proxy01.webkit.org:3128"
 S3URL = "https://s3-us-west-2.amazonaws.com/"
 WithProperties = properties.WithProperties
+RESULTS_WEBKIT = 'https://results.webkit.org'
+RESULTS_SERVER_API_KEY = 'RESULTS_SERVER_API_KEY'
 
 
 class TestWithFailureCount(shell.Test):
@@ -416,13 +418,22 @@
                "--clobber-old-results",
                "--builder-name", WithProperties("%(buildername)s"),
                "--build-number", WithProperties("%(buildnumber)s"),
+               "--buildbot-worker", WithProperties("%(slavename)s"),
                "--master-name", "webkit.org",
+               "--buildbot-master", "build.webkit.org",
+               "--report", RESULTS_WEBKIT,
                "--test-results-server", "webkit-test-results.webkit.org",
                "--exit-after-n-crashes-or-timeouts", "50",
                "--exit-after-n-failures", "500",
                WithProperties("--%(configuration)s")]
 
+    def __init__(self, *args, **kwargs):
+        kwargs['logEnviron'] = False
+        shell.Test.__init__(self, *args, **kwargs)
+
     def start(self):
+        self.slaveEnvironment[RESULTS_SERVER_API_KEY] = os.getenv(RESULTS_SERVER_API_KEY)
+
         platform = self.getProperty('platform')
         appendCustomTestingFlags(self, platform, self.getProperty('device_model'))
         additionalArguments = self.getProperty('additionalArguments')
@@ -530,10 +541,26 @@
     name = "run-api-tests"
     description = ["api tests running"]
     descriptionDone = ["api-tests"]
-    command = ["python", "./Tools/Scripts/run-api-tests", "--no-build", WithProperties("--%(configuration)s"), "--verbose"]
+    command = [
+        "python",
+        "./Tools/Scripts/run-api-tests",
+        "--no-build",
+        WithProperties("--%(configuration)s"),
+        "--verbose",
+        "--buildbot-master", "build.webkit.org",
+        "--builder-name", WithProperties("%(buildername)s"),
+        "--build-number", WithProperties("%(buildnumber)s"),
+        "--buildbot-worker", WithProperties("%(slavename)s"),
+        "--report", RESULTS_WEBKIT,
+    ]
     failedTestsFormatString = "%d api test%s failed or timed out"
 
+    def __init__(self, *args, **kwargs):
+        kwargs['logEnviron'] = False
+        TestWithFailureCount.__init__(self, *args, **kwargs)
+
     def start(self):
+        self.slaveEnvironment[RESULTS_SERVER_API_KEY] = os.getenv(RESULTS_SERVER_API_KEY)
         appendCustomTestingFlags(self, self.getProperty('platform'), self.getProperty('device_model'))
         return shell.Test.start(self)
 
@@ -550,10 +577,26 @@
     name = "webkitpy-test"
     description = ["python-tests running"]
     descriptionDone = ["python-tests"]
-    command = ["python", "./Tools/Scripts/test-webkitpy", "--verbose", WithProperties("--%(configuration)s")]
+    command = [
+        "python",
+        "./Tools/Scripts/test-webkitpy",
+        "--verbose",
+        WithProperties("--%(configuration)s"),
+        "--buildbot-master", "build.webkit.org",
+        "--builder-name", WithProperties("%(buildername)s"),
+        "--build-number", WithProperties("%(buildnumber)s"),
+        "--buildbot-worker", WithProperties("%(slavename)s"),
+        "--report", RESULTS_WEBKIT,
+    ]
     failedTestsFormatString = "%d python test%s failed"
 
+    def __init__(self, *args, **kwargs):
+        kwargs['logEnviron'] = False
+        TestWithFailureCount.__init__(self, *args, **kwargs)
+
     def start(self):
+        self.slaveEnvironment[RESULTS_SERVER_API_KEY] = os.getenv(RESULTS_SERVER_API_KEY)
+
         platform = self.getProperty('platform')
         # Python tests are flaky on the GTK builders, running them serially
         # helps and does not significantly prolong the cycle time.

Modified: trunk/Tools/ChangeLog (250783 => 250784)


--- trunk/Tools/ChangeLog	2019-10-07 19:22:17 UTC (rev 250783)
+++ trunk/Tools/ChangeLog	2019-10-07 20:07:33 UTC (rev 250784)
@@ -1,3 +1,29 @@
+2019-10-07  Jonathan Bedard  <jbed...@apple.com>
+
+        results.webkit.org: Start reporting results
+        https://bugs.webkit.org/show_bug.cgi?id=202639
+
+        Reviewed by Dewei Zhu.
+
+        * BuildSlaveSupport/build.webkit.org-config/loadConfig.py:
+        (loadBuilderConfig): Load API key for results.webkit.org.
+        * BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py:
+        (create_mock_slave_passwords_dict): Add mock for API key.
+        * BuildSlaveSupport/build.webkit.org-config/steps.py:
+        (RunWebKitTests): Start reporting to results.webkit.org.
+        (RunWebKitTests.__init__): Do not print the environment to hide the API key.
+        (RunWebKitTests.start): Add the API key to the environment.
+        (RunAPITests): Start reporting to results.webkit.org.
+        (RunAPITests.__init__): Do not print the environment to hide the API key.
+        (RunAPITests.start): Add the API key to the environment.
+        (RunPythonTests): Start reporting to results.webkit.org.
+        (RunPythonTests.__init__): Do not print the environment to hide the API key.
+        (RunPythonTests.start): Add the API key to the environment.
+        * Scripts/webkitpy/results/upload.py:
+        (Upload):
+        (Upload.upload): Add API_KEY, if it exists, to the request.
+        (Upload.upload_archive): Ditto.
+
 2019-10-07  Matt Lewis  <jlew...@apple.com>
 
         Unreviewed, rolling out r250750.

Modified: trunk/Tools/Scripts/webkitpy/results/upload.py (250783 => 250784)


--- trunk/Tools/Scripts/webkitpy/results/upload.py	2019-10-07 19:22:17 UTC (rev 250783)
+++ trunk/Tools/Scripts/webkitpy/results/upload.py	2019-10-07 20:07:33 UTC (rev 250784)
@@ -22,6 +22,7 @@
 
 import webkitpy.thirdparty.autoinstalled.requests
 
+import os
 import json
 import requests
 import sys
@@ -31,6 +32,7 @@
 
 
 class Upload(object):
+    API_KEY = os.getenv('RESULTS_SERVER_API_KEY')
     UPLOAD_ENDPOINT = '/api/upload'
     ARCHIVE_UPLOAD_ENDPOINT = '/api/upload/archive'
     BUILDBOT_DETAILS = ['buildbot-master', 'builder-name', 'build-number', 'buildbot-worker']
@@ -169,7 +171,10 @@
 
     def upload(self, hostname, log_line_func=lambda val: sys.stdout.write(val + '\n')):
         try:
-            response = requests.post('{}{}'.format(hostname, self.UPLOAD_ENDPOINT), data="" cls=Upload.Encoder))
+            data = ""
+            if self.API_KEY:
+                data['api_key'] = self.API_KEY
+            response = requests.post('{}{}'.format(hostname, self.UPLOAD_ENDPOINT), data=""
         except requests.exceptions.ConnectionError:
             log_line_func(' ' * 4 + 'Failed to upload to {}, results server not online'.format(hostname))
             return False
@@ -195,6 +200,8 @@
             )
             if self.timestamp:
                 meta_data['timestamp'] = self.timestamp
+            if self.API_KEY:
+                meta_data['api_key'] = self.API_KEY
             response = requests.post(
                 '{}{}'.format(hostname, self.ARCHIVE_UPLOAD_ENDPOINT),
                 data=""
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to