Changeset 250784 in webkit


Ignore:
Timestamp:
Oct 7, 2019 1:07:33 PM (5 years ago)
Author:
Jonathan Bedard
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.

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/loadConfig.py

    r250746 r250784  
    5050    else:
    5151        passwords = json.load(open('passwords.json'))
     52    results_server_api_key = passwords.get('results-server-api-key')
     53    if results_server_api_key:
     54        os.environ['RESULTS_SERVER_API_KEY'] = results_server_api_key
     55
    5256    config = json.load(open('config.json'))
    53 
    5457    c['slaves'] = [BuildSlave(slave['name'], passwords[slave['name']], max_builds=1) for slave in config['slaves']]
    5558
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py

    r175798 r250784  
    3232    with open('config.json', 'r') as config_json:
    3333        config_dict = json.load(config_json)
    34     return dict([(slave['name'], '1234') for slave in config_dict['slaves']])
     34    result = dict([(slave['name'], '1234') for slave in config_dict['slaves']])
     35    result['results-server-api-key'] = 'api-key'
     36    return result
    3537
    3638if __name__ == '__main__':
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/steps.py

    r250746 r250784  
    3636S3URL = "https://s3-us-west-2.amazonaws.com/"
    3737WithProperties = properties.WithProperties
     38RESULTS_WEBKIT = 'https://results.webkit.org'
     39RESULTS_SERVER_API_KEY = 'RESULTS_SERVER_API_KEY'
    3840
    3941
     
    417419               "--builder-name", WithProperties("%(buildername)s"),
    418420               "--build-number", WithProperties("%(buildnumber)s"),
     421               "--buildbot-worker", WithProperties("%(slavename)s"),
    419422               "--master-name", "webkit.org",
     423               "--buildbot-master", "build.webkit.org",
     424               "--report", RESULTS_WEBKIT,
    420425               "--test-results-server", "webkit-test-results.webkit.org",
    421426               "--exit-after-n-crashes-or-timeouts", "50",
     
    423428               WithProperties("--%(configuration)s")]
    424429
    425     def start(self):
     430    def __init__(self, *args, **kwargs):
     431        kwargs['logEnviron'] = False
     432        shell.Test.__init__(self, *args, **kwargs)
     433
     434    def start(self):
     435        self.slaveEnvironment[RESULTS_SERVER_API_KEY] = os.getenv(RESULTS_SERVER_API_KEY)
     436
    426437        platform = self.getProperty('platform')
    427438        appendCustomTestingFlags(self, platform, self.getProperty('device_model'))
     
    531542    description = ["api tests running"]
    532543    descriptionDone = ["api-tests"]
    533     command = ["python", "./Tools/Scripts/run-api-tests", "--no-build", WithProperties("--%(configuration)s"), "--verbose"]
     544    command = [
     545        "python",
     546        "./Tools/Scripts/run-api-tests",
     547        "--no-build",
     548        WithProperties("--%(configuration)s"),
     549        "--verbose",
     550        "--buildbot-master", "build.webkit.org",
     551        "--builder-name", WithProperties("%(buildername)s"),
     552        "--build-number", WithProperties("%(buildnumber)s"),
     553        "--buildbot-worker", WithProperties("%(slavename)s"),
     554        "--report", RESULTS_WEBKIT,
     555    ]
    534556    failedTestsFormatString = "%d api test%s failed or timed out"
    535557
    536     def start(self):
     558    def __init__(self, *args, **kwargs):
     559        kwargs['logEnviron'] = False
     560        TestWithFailureCount.__init__(self, *args, **kwargs)
     561
     562    def start(self):
     563        self.slaveEnvironment[RESULTS_SERVER_API_KEY] = os.getenv(RESULTS_SERVER_API_KEY)
    537564        appendCustomTestingFlags(self, self.getProperty('platform'), self.getProperty('device_model'))
    538565        return shell.Test.start(self)
     
    551578    description = ["python-tests running"]
    552579    descriptionDone = ["python-tests"]
    553     command = ["python", "./Tools/Scripts/test-webkitpy", "--verbose", WithProperties("--%(configuration)s")]
     580    command = [
     581        "python",
     582        "./Tools/Scripts/test-webkitpy",
     583        "--verbose",
     584        WithProperties("--%(configuration)s"),
     585        "--buildbot-master", "build.webkit.org",
     586        "--builder-name", WithProperties("%(buildername)s"),
     587        "--build-number", WithProperties("%(buildnumber)s"),
     588        "--buildbot-worker", WithProperties("%(slavename)s"),
     589        "--report", RESULTS_WEBKIT,
     590    ]
    554591    failedTestsFormatString = "%d python test%s failed"
    555592
    556     def start(self):
     593    def __init__(self, *args, **kwargs):
     594        kwargs['logEnviron'] = False
     595        TestWithFailureCount.__init__(self, *args, **kwargs)
     596
     597    def start(self):
     598        self.slaveEnvironment[RESULTS_SERVER_API_KEY] = os.getenv(RESULTS_SERVER_API_KEY)
     599
    557600        platform = self.getProperty('platform')
    558601        # Python tests are flaky on the GTK builders, running them serially
  • trunk/Tools/ChangeLog

    r250775 r250784  
     12019-10-07  Jonathan Bedard  <jbedard@apple.com>
     2
     3        results.webkit.org: Start reporting results
     4        https://bugs.webkit.org/show_bug.cgi?id=202639
     5
     6        Reviewed by Dewei Zhu.
     7
     8        * BuildSlaveSupport/build.webkit.org-config/loadConfig.py:
     9        (loadBuilderConfig): Load API key for results.webkit.org.
     10        * BuildSlaveSupport/build.webkit.org-config/make_passwords_json.py:
     11        (create_mock_slave_passwords_dict): Add mock for API key.
     12        * BuildSlaveSupport/build.webkit.org-config/steps.py:
     13        (RunWebKitTests): Start reporting to results.webkit.org.
     14        (RunWebKitTests.__init__): Do not print the environment to hide the API key.
     15        (RunWebKitTests.start): Add the API key to the environment.
     16        (RunAPITests): Start reporting to results.webkit.org.
     17        (RunAPITests.__init__): Do not print the environment to hide the API key.
     18        (RunAPITests.start): Add the API key to the environment.
     19        (RunPythonTests): Start reporting to results.webkit.org.
     20        (RunPythonTests.__init__): Do not print the environment to hide the API key.
     21        (RunPythonTests.start): Add the API key to the environment.
     22        * Scripts/webkitpy/results/upload.py:
     23        (Upload):
     24        (Upload.upload): Add API_KEY, if it exists, to the request.
     25        (Upload.upload_archive): Ditto.
     26
    1272019-10-07  Matt Lewis  <jlewis3@apple.com>
    228
  • trunk/Tools/Scripts/webkitpy/results/upload.py

    r249652 r250784  
    2323import webkitpy.thirdparty.autoinstalled.requests
    2424
     25import os
    2526import json
    2627import requests
     
    3233
    3334class Upload(object):
     35    API_KEY = os.getenv('RESULTS_SERVER_API_KEY')
    3436    UPLOAD_ENDPOINT = '/api/upload'
    3537    ARCHIVE_UPLOAD_ENDPOINT = '/api/upload/archive'
     
    170172    def upload(self, hostname, log_line_func=lambda val: sys.stdout.write(val + '\n')):
    171173        try:
    172             response = requests.post('{}{}'.format(hostname, self.UPLOAD_ENDPOINT), data=json.dumps(self, cls=Upload.Encoder))
     174            data = Upload.Encoder().default(self)
     175            if self.API_KEY:
     176                data['api_key'] = self.API_KEY
     177            response = requests.post('{}{}'.format(hostname, self.UPLOAD_ENDPOINT), data=json.dumps(data))
    173178        except requests.exceptions.ConnectionError:
    174179            log_line_func(' ' * 4 + 'Failed to upload to {}, results server not online'.format(hostname))
     
    196201            if self.timestamp:
    197202                meta_data['timestamp'] = self.timestamp
     203            if self.API_KEY:
     204                meta_data['api_key'] = self.API_KEY
    198205            response = requests.post(
    199206                '{}{}'.format(hostname, self.ARCHIVE_UPLOAD_ENDPOINT),
Note: See TracChangeset for help on using the changeset viewer.