Changeset 272743 in webkit


Ignore:
Timestamp:
Feb 11, 2021, 11:59:28 AM (5 years ago)
Author:
aakash_jain@apple.com
Message:

build.webkit.org should display commit identifier in builds
https://bugs.webkit.org/show_bug.cgi?id=221730

Reviewed by Jonathan Bedard.

  • CISupport/build-webkit-org/steps.py:

(ExtractTestResults.finished):
(ShowIdentifier): build-step to show commit identifier.
(ShowIdentifier.init):
(ShowIdentifier.start):
(ShowIdentifier.evaluateCommand):
(ShowIdentifier.getLastBuildStepByName):
(ShowIdentifier.url_for_identifier):
(ShowIdentifier.getResultSummary): Display custom failure message.
(ShowIdentifier.hideStepIf): Hide this step if successful.

  • CISupport/build-webkit-org/steps_unittest.py:

(BuildStepMixinAdditions.executedSteps): filter wasn't working as expected with python 3, replaced
with list comprehension.
(TestShowIdentifier): Added unit-tests.
(TestShowIdentifier.test_success):
(TestShowIdentifier.test_failure):

  • CISupport/build-webkit-org/factories.py: Added ShowIdentifier build step.
Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/CISupport/build-webkit-org/factories.py

    r272032 r272743  
    3232        self.addStep(ConfigureBuild(platform=platform, configuration=configuration, architecture=" ".join(architectures), buildOnly=buildOnly, additionalArguments=additionalArguments, device_model=device_model))
    3333        self.addStep(CheckOutSource())
     34        self.addStep(ShowIdentifier())
    3435        if not (platform == "jsc-only"):
    3536            self.addStep(KillOldProcesses())
  • trunk/Tools/CISupport/build-webkit-org/steps.py

    r272681 r272743  
    3737APPLE_WEBKIT_AWS_PROXY = "http://proxy01.webkit.org:3128"
    3838BUILD_WEBKIT_HOSTNAME = 'build.webkit.org'
     39COMMITS_INFO_URL = 'https://commits.webkit.org/'
    3940CURRENT_HOSTNAME = socket.gethostname().strip()
    4041RESULTS_WEBKIT_URL = 'https://results.webkit.org'
     
    11251126        self.addCustomURLs()
    11261127        return master.MasterShellCommand.finished(self, result)
     1128
     1129
     1130class ShowIdentifier(shell.ShellCommand):
     1131    name = 'show-identifier'
     1132    identifier_re = '^Identifier: (.*)$'
     1133    flunkOnFailure = False
     1134    haltOnFailure = False
     1135
     1136    def __init__(self, **kwargs):
     1137        shell.ShellCommand.__init__(self, timeout=2 * 60, logEnviron=False, **kwargs)
     1138
     1139    def start(self):
     1140        self.log_observer = logobserver.BufferLogObserver()
     1141        self.addLogObserver('stdio', self.log_observer)
     1142        revision = self.getProperty('got_revision')
     1143        self.setCommand(['python', 'Tools/Scripts/git-webkit', 'find', 'r{}'.format(revision)])
     1144        return shell.ShellCommand.start(self)
     1145
     1146    def evaluateCommand(self, cmd):
     1147        rc = shell.ShellCommand.evaluateCommand(self, cmd)
     1148        if rc != SUCCESS:
     1149            return rc
     1150
     1151        log_text = self.log_observer.getStdout()
     1152        match = re.search(self.identifier_re, log_text, re.MULTILINE)
     1153        if match:
     1154            identifier = match.group(1)
     1155            self.setProperty('identifier', identifier)
     1156            step = self.getLastBuildStepByName(CheckOutSource.name)
     1157            if not step:
     1158                step = self
     1159            step.addURL('Updated to {}'.format(identifier), self.url_for_identifier(identifier))
     1160            self.descriptionDone = 'Identifier: {}'.format(identifier)
     1161        else:
     1162            self.descriptionDone = 'Failed to find identifier'
     1163        return rc
     1164
     1165    def getLastBuildStepByName(self, name):
     1166        for step in reversed(self.build.executedSteps):
     1167            if name in step.name:
     1168                return step
     1169        return None
     1170
     1171    def url_for_identifier(self, identifier):
     1172        return '{}{}'.format(COMMITS_INFO_URL, identifier)
     1173
     1174    def getResultSummary(self):
     1175        if self.results != SUCCESS:
     1176            return {u'step': u'Failed to find identifier'}
     1177        return shell.ShellCommand.getResultSummary(self)
     1178
     1179    def hideStepIf(self, results, step):
     1180        return results == SUCCESS
  • trunk/Tools/CISupport/build-webkit-org/steps_unittest.py

    r270354 r272743  
    1 # Copyright (C) 2020 Apple Inc. All rights reserved.
     1# Copyright (C) 2020-2021 Apple Inc. All rights reserved.
    22#
    33# Redistribution and use in source and binary forms, with or without
     
    107107    @property
    108108    def executedSteps(self):
    109         return filter(lambda step: not step.stopped, self.previous_steps)
     109        return [step for step in self.previous_steps if not step.stopped]
    110110
    111111    def setProperty(self, name, value, source='Unknown'):
     
    497497        self.expectOutcome(result=FAILURE, state_string='compiled (failure)')
    498498        return self.runStep()
     499
     500
     501class TestShowIdentifier(BuildStepMixinAdditions, unittest.TestCase):
     502    def setUp(self):
     503        self.longMessage = True
     504        return self.setUpBuildStep()
     505
     506    def tearDown(self):
     507        return self.tearDownBuildStep()
     508
     509    def test_success(self):
     510        self.setupStep(ShowIdentifier())
     511        self.setProperty('got_revision', '272692')
     512        self.expectRemoteCommands(
     513            ExpectShell(workdir='wkdir',
     514                        timeout=120,
     515                        logEnviron=False,
     516                        command=['python', 'Tools/Scripts/git-webkit', 'find', 'r272692']) +
     517            ExpectShell.log('stdio', stdout='Identifier: 233939@trunk') +
     518            0,
     519        )
     520        self.expectOutcome(result=SUCCESS, state_string='Identifier: 233939@trunk')
     521        rc = self.runStep()
     522        self.assertEqual(self.getProperty('identifier'), '233939@trunk')
     523        return rc
     524
     525    def test_failure(self):
     526        self.setupStep(ShowIdentifier())
     527        self.setProperty('got_revision', '272692')
     528        self.expectRemoteCommands(
     529            ExpectShell(workdir='wkdir',
     530                        timeout=120,
     531                        logEnviron=False,
     532                        command=['python', 'Tools/Scripts/git-webkit', 'find', 'r272692']) +
     533            ExpectShell.log('stdio', stdout='Unexpected failure') +
     534            2,
     535        )
     536        self.expectOutcome(result=FAILURE, state_string='Failed to find identifier')
     537        return self.runStep()
  • trunk/Tools/ChangeLog

    r272738 r272743  
     12021-02-11  Aakash Jain  <aakash_jain@apple.com>
     2
     3        build.webkit.org should display commit identifier in builds
     4        https://bugs.webkit.org/show_bug.cgi?id=221730
     5
     6        Reviewed by Jonathan Bedard.
     7
     8        * CISupport/build-webkit-org/steps.py:
     9        (ExtractTestResults.finished):
     10        (ShowIdentifier): build-step to show commit identifier.
     11        (ShowIdentifier.__init__):
     12        (ShowIdentifier.start):
     13        (ShowIdentifier.evaluateCommand):
     14        (ShowIdentifier.getLastBuildStepByName):
     15        (ShowIdentifier.url_for_identifier):
     16        (ShowIdentifier.getResultSummary): Display custom failure message.
     17        (ShowIdentifier.hideStepIf): Hide this step if successful.
     18        * CISupport/build-webkit-org/steps_unittest.py:
     19        (BuildStepMixinAdditions.executedSteps): filter wasn't working as expected with python 3, replaced
     20        with list comprehension.
     21        (TestShowIdentifier): Added unit-tests.
     22        (TestShowIdentifier.test_success):
     23        (TestShowIdentifier.test_failure):
     24        * CISupport/build-webkit-org/factories.py: Added ShowIdentifier build step.
     25
    1262021-02-11  Aakash Jain  <aakash_jain@apple.com>
    227
Note: See TracChangeset for help on using the changeset viewer.