Changeset 263267 in webkit


Ignore:
Timestamp:
Jun 19, 2020, 8:31:10 AM (5 years ago)
Author:
aakash_jain@apple.com
Message:

Improve handling of trac downtime by commit-queue
https://bugs.webkit.org/show_bug.cgi?id=213377

Reviewed by Jonathan Bedard.

  • BuildSlaveSupport/ews-build/steps.py: Load contributors.json from disk when loading from trac fails.

(ValidateCommiterAndReviewer.load_contributors_from_disk):
(ValidateCommiterAndReviewer.load_contributors_from_trac):
(ValidateCommiterAndReviewer.load_contributors):

  • BuildSlaveSupport/ews-build/steps_unittest.py: Added unit-test
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/BuildSlaveSupport/ews-build/steps.py

    r262379 r263267  
    679679    contributors = {}
    680680
    681     def load_contributors(self):
     681    def load_contributors_from_disk(self):
     682        cwd = os.path.abspath(os.path.dirname(__file__))
     683        tools_dir_path = os.path.dirname(os.path.dirname(cwd))
     684        contributors_path = os.path.join(tools_dir_path, 'Scripts/webkitpy/common/config/contributors.json')
     685        try:
     686            return json.load(open(contributors_path))
     687        except Exception as e:
     688            self._addToLog('stdio', 'Failed to load {}\n'.format(contributors_path))
     689            return {}
     690
     691    def load_contributors_from_trac(self):
    682692        try:
    683693            response = requests.get(self.url_text)
     
    685695                self._addToLog('stdio', 'Failed to access {} with status code: {}\n'.format(self.url_text, response.status_code))
    686696                return {}
     697            return response.json()
    687698        except Exception as e:
    688699            self._addToLog('stdio', 'Failed to access {url}\n'.format(url=self.url_text))
    689700            return {}
    690701
    691         contributors_json = response.json()
     702    def load_contributors(self):
     703        contributors_json = self.load_contributors_from_trac()
     704        if not contributors_json:
     705            contributors_json = self.load_contributors_from_disk()
     706
    692707        contributors = {}
    693708        for key, value in contributors_json.iteritems():
  • trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py

    r262379 r263267  
    2525import os
    2626import shutil
     27import sys
    2728import tempfile
    2829
     
    34263427        return self.runStep()
    34273428
     3429    def test_load_contributors_from_disk(self):
     3430        ValidateCommiterAndReviewer._addToLog = lambda cls, logtype, log: sys.stdout.write(log)
     3431        contributors = ValidateCommiterAndReviewer().load_contributors_from_disk()
     3432        self.assertEqual(contributors['Aakash Jain']['nicks'], ['aakash_jain'])
     3433
    34283434
    34293435class TestCheckPatchStatusOnEWSQueues(BuildStepMixinAdditions, unittest.TestCase):
  • trunk/Tools/ChangeLog

    r263263 r263267  
     12020-06-19  Aakash Jain  <aakash_jain@apple.com>
     2
     3        Improve handling of trac downtime by commit-queue
     4        https://bugs.webkit.org/show_bug.cgi?id=213377
     5
     6        Reviewed by Jonathan Bedard.
     7
     8        * BuildSlaveSupport/ews-build/steps.py: Load contributors.json from disk when loading from trac fails.
     9        (ValidateCommiterAndReviewer.load_contributors_from_disk):
     10        (ValidateCommiterAndReviewer.load_contributors_from_trac):
     11        (ValidateCommiterAndReviewer.load_contributors):
     12        * BuildSlaveSupport/ews-build/steps_unittest.py: Added unit-test
     13
    1142020-06-19  Lauro Moura  <lmoura@igalia.com>
    215
Note: See TracChangeset for help on using the changeset viewer.