Title: [258790] trunk/Tools
Revision
258790
Author
[email protected]
Date
2020-03-20 14:38:36 -0700 (Fri, 20 Mar 2020)

Log Message

commit-queue should skip building and testing if patch already passed tests on mac-wk2 queue
https://bugs.webkit.org/show_bug.cgi?id=208938

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/steps.py:
(RunWebKitTests.doStepIf): Skip testing if patch already passed mac-wk2 tests.
(CheckPatchStatusOnEWSQueues): Build-step to check patch status on other queues.
(CheckPatchStatusOnEWSQueues.get_patch_status):
(CheckPatchStatusOnEWSQueues.start):
* BuildSlaveSupport/ews-build/steps_unittest.py:
(test_skip_for_mac_wk2_passed_patch_on_commit_queue): Added unit-tests.
* BuildSlaveSupport/ews-build/factories.py: Added build-step to check the patch status on other queues.
* BuildSlaveSupport/ews-build/factories_unittest.py: Updated unit-test.
* BuildSlaveSupport/ews-app/ews/views/statusbubble.py: Added the new step status to STEPS_TO_HIDE.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/ews-app/ews/views/statusbubble.py (258789 => 258790)


--- trunk/Tools/BuildSlaveSupport/ews-app/ews/views/statusbubble.py	2020-03-20 21:21:04 UTC (rev 258789)
+++ trunk/Tools/BuildSlaveSupport/ews-app/ews/views/statusbubble.py	2020-03-20 21:38:36 UTC (rev 258790)
@@ -62,7 +62,7 @@
                      '^Printed configuration$', '^Checked patch relevance$', '^Deleted .git/index.lock$',
                      '^triggered.*$', '^Found modified ChangeLogs$', '^Created local git commit$', '^Set build summary$',
                      '^Validated commiter$', '^Validated commiter and reviewer$', '^Validated ChangeLog and Reviewer$',
-                     '^Removed flags on bugzilla patch$']
+                     '^Removed flags on bugzilla patch$', '^Checked patch status on other queues$']
     DAYS_TO_CHECK = 3
     BUILDER_ICON = u'\U0001f6e0'
     TESTER_ICON = u'\U0001f52c'

Modified: trunk/Tools/BuildSlaveSupport/ews-build/factories.py (258789 => 258790)


--- trunk/Tools/BuildSlaveSupport/ews-build/factories.py	2020-03-20 21:21:04 UTC (rev 258789)
+++ trunk/Tools/BuildSlaveSupport/ews-build/factories.py	2020-03-20 21:38:36 UTC (rev 258790)
@@ -25,7 +25,7 @@
 from buildbot.steps import trigger
 
 from steps import (ApplyPatch, ApplyWatchList, CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance,
-                   CheckStyle, CompileJSC, CompileWebKit, ConfigureBuild, CreateLocalGITCommit,
+                   CheckPatchStatusOnEWSQueues, CheckStyle, CompileJSC, CompileWebKit, ConfigureBuild, CreateLocalGITCommit,
                    DownloadBuiltProduct, ExtractBuiltProduct, FindModifiedChangeLogs, InstallGtkDependencies,
                    InstallWpeDependencies, KillOldProcesses, PrintConfiguration, PushCommitToWebKitRepo,
                    RunAPITests, RunBindingsTests, RunBuildWebKitOrgUnitTests, RunEWSBuildbotCheckConfig, RunEWSUnitTests,
@@ -215,6 +215,7 @@
         self.addStep(CompileWebKit(skipUpload=True))
         self.addStep(KillOldProcesses())
         self.addStep(ValidatePatch(addURLs=False, verifycqplus=True))
+        self.addStep(CheckPatchStatusOnEWSQueues())
         self.addStep(RunWebKitTests())
         self.addStep(ValidatePatch(addURLs=False, verifycqplus=True))
         self.addStep(CheckOutSource())

Modified: trunk/Tools/BuildSlaveSupport/ews-build/factories_unittest.py (258789 => 258790)


--- trunk/Tools/BuildSlaveSupport/ews-build/factories_unittest.py	2020-03-20 21:21:04 UTC (rev 258789)
+++ trunk/Tools/BuildSlaveSupport/ews-build/factories_unittest.py	2020-03-20 21:38:36 UTC (rev 258790)
@@ -191,6 +191,7 @@
             _BuildStepFactory(steps.CompileWebKit, skipUpload=True),
             _BuildStepFactory(steps.KillOldProcesses),
             _BuildStepFactory(steps.ValidatePatch, addURLs=False, verifycqplus=True),
+            _BuildStepFactory(steps.CheckPatchStatusOnEWSQueues),
             _BuildStepFactory(steps.RunWebKitTests),
             _BuildStepFactory(steps.ValidatePatch, addURLs=False, verifycqplus=True),
             _BuildStepFactory(steps.CheckOutSource),

Modified: trunk/Tools/BuildSlaveSupport/ews-build/steps.py (258789 => 258790)


--- trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2020-03-20 21:21:04 UTC (rev 258789)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2020-03-20 21:38:36 UTC (rev 258790)
@@ -37,7 +37,8 @@
 
 BUG_SERVER_URL = 'https://bugs.webkit.org/'
 S3URL = 'https://s3-us-west-2.amazonaws.com/'
-EWS_URL = 'https://ews-build.webkit.org/'
+EWS_BUILD_URL = 'https://ews-build.webkit.org/'
+EWS_URL = 'https://ews.webkit.org/'
 WithProperties = properties.WithProperties
 Interpolate = properties.Interpolate
 
@@ -1634,7 +1635,8 @@
         self.incorrectLayoutLines = []
 
     def doStepIf(self, step):
-        return not (self.getProperty('revert') and self.getProperty('buildername', '').lower() == 'commit-queue')
+        return not ((self.getProperty('buildername', '').lower() == 'commit-queue') and
+                    (self.getProperty('revert') or self.getProperty('passed_mac_wk2')))
 
     def start(self):
         self.log_observer = logobserver.BufferLogObserver(wantStderr=True)
@@ -2050,7 +2052,7 @@
 class DownloadBuiltProductFromMaster(DownloadBuiltProduct):
     command = ['python', 'Tools/BuildSlaveSupport/download-built-product',
         WithProperties('--%(configuration)s'),
-        WithProperties(EWS_URL + 'archives/%(fullPlatform)s-%(architecture)s-%(configuration)s/%(patch_id)s.zip')]
+        WithProperties(EWS_BUILD_URL + 'archives/%(fullPlatform)s-%(architecture)s-%(configuration)s/%(patch_id)s.zip')]
     haltOnFailure = True
     flunkOnFailure = True
 
@@ -2582,3 +2584,39 @@
         if self.results != SUCCESS:
             return {u'step': u'Failed to push commit to Webkit repository'}
         return shell.ShellCommand.getResultSummary(self)
+
+
+class CheckPatchStatusOnEWSQueues(buildstep.BuildStep, BugzillaMixin):
+    name = 'check-status-on-other-ewses'
+    descriptionDone = ['Checked patch status on other queues']
+
+    def get_patch_status(self, patch_id, queue):
+        url = ''.format(EWS_URL, patch_id)
+        try:
+            response = requests.get(url)
+            if response.status_code != 200:
+                self._addToLog('stdio', 'Failed to access {} with status code: {}\n'.format(url, response.status_code))
+                return -1
+            queue_data = response.json().get(queue)
+            if not queue_data:
+                return -1
+            return queue_data.get('state')
+        except Exception as e:
+            self._addToLog('stdio', 'Failed to access {}\n'.format(url))
+            return -1
+
+    @defer.inlineCallbacks
+    def _addToLog(self, logName, message):
+        try:
+            log = self.getLog(logName)
+        except KeyError:
+            log = yield self.addLog(logName)
+        log.addStdout(message)
+
+    def start(self):
+        patch_id = self.getProperty('patch_id', '')
+        patch_status_on_mac_wk2 = self.get_patch_status(patch_id, 'mac-wk2')
+        if patch_status_on_mac_wk2 == SUCCESS:
+            self.setProperty('passed_mac_wk2', True)
+        self.finished(SUCCESS)
+        return None

Modified: trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py (258789 => 258790)


--- trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py	2020-03-20 21:21:04 UTC (rev 258789)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py	2020-03-20 21:38:36 UTC (rev 258790)
@@ -36,8 +36,8 @@
 
 from steps import (AnalyzeAPITestsResults, AnalyzeCompileWebKitResults, AnalyzeJSCTestsResults,
                    AnalyzeLayoutTestsResults, ApplyPatch, ApplyWatchList, ArchiveBuiltProduct, ArchiveTestResults,
-                   CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance, CheckStyle, CleanBuild,
-                   CleanUpGitIndexLock, CleanWorkingDirectory, CompileJSC, CompileJSCToT, CompileWebKit,
+                   CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance, CheckPatchStatusOnEWSQueues, CheckStyle,
+                   CleanBuild, CleanUpGitIndexLock, CleanWorkingDirectory, CompileJSC, CompileJSCToT, CompileWebKit,
                    CompileWebKitToT, ConfigureBuild, CreateLocalGITCommit,
                    DownloadBuiltProduct, DownloadBuiltProductFromMaster, ExtractBuiltProduct, ExtractTestResults,
                    FindModifiedChangeLogs, InstallGtkDependencies, InstallWpeDependencies, KillOldProcesses,
@@ -1545,6 +1545,16 @@
         self.expectOutcome(result=SKIPPED, state_string='layout-tests (skipped)')
         return self.runStep()
 
+    def test_skip_for_mac_wk2_passed_patch_on_commit_queue(self):
+        self.configureStep()
+        self.setProperty('patch_id', '1234')
+        self.setProperty('buildername', 'Commit-Queue')
+        self.setProperty('fullPlatform', 'mac')
+        self.setProperty('configuration', 'debug')
+        self.setProperty('passed_mac_wk2', True)
+        self.expectOutcome(result=SKIPPED, state_string='layout-tests (skipped)')
+        return self.runStep()
+
     def test_parse_results_json_regression(self):
         self.configureStep()
         self.setProperty('fullPlatform', 'ios-simulator')
@@ -3283,6 +3293,34 @@
         self.expectOutcome(result=FAILURE, state_string='[email protected] does not have reviewer permissions')
         return self.runStep()
 
+
+class TestCheckPatchStatusOnEWSQueues(BuildStepMixinAdditions, unittest.TestCase):
+    def setUp(self):
+        self.longMessage = True
+        return self.setUpBuildStep()
+
+    def tearDown(self):
+        return self.tearDownBuildStep()
+
+    def test_success(self):
+        CheckPatchStatusOnEWSQueues.get_patch_status = lambda cls, patch_id, queue: SUCCESS
+        self.setupStep(CheckPatchStatusOnEWSQueues())
+        self.setProperty('patch_id', '1234')
+        self.expectOutcome(result=SUCCESS, state_string='Checked patch status on other queues')
+        rc = self.runStep()
+        self.assertEqual(self.getProperty('passed_mac_wk2'), True)
+        return rc
+
+    def test_failure(self):
+        self.setupStep(CheckPatchStatusOnEWSQueues())
+        self.setProperty('patch_id', '1234')
+        CheckPatchStatusOnEWSQueues.get_patch_status = lambda cls, patch_id, queue: FAILURE
+        self.expectOutcome(result=SUCCESS, state_string='Checked patch status on other queues')
+        rc = self.runStep()
+        self.assertEqual(self.getProperty('passed_mac_wk2'), None)
+        return rc
+
+
 class TestPushCommitToWebKitRepo(BuildStepMixinAdditions, unittest.TestCase):
     def setUp(self):
         self.longMessage = True

Modified: trunk/Tools/ChangeLog (258789 => 258790)


--- trunk/Tools/ChangeLog	2020-03-20 21:21:04 UTC (rev 258789)
+++ trunk/Tools/ChangeLog	2020-03-20 21:38:36 UTC (rev 258790)
@@ -1,5 +1,23 @@
 2020-03-20  Aakash Jain  <[email protected]>
 
+        commit-queue should skip building and testing if patch already passed tests on mac-wk2 queue
+        https://bugs.webkit.org/show_bug.cgi?id=208938
+
+        Reviewed by Jonathan Bedard.
+
+        * BuildSlaveSupport/ews-build/steps.py:
+        (RunWebKitTests.doStepIf): Skip testing if patch already passed mac-wk2 tests.
+        (CheckPatchStatusOnEWSQueues): Build-step to check patch status on other queues.
+        (CheckPatchStatusOnEWSQueues.get_patch_status):
+        (CheckPatchStatusOnEWSQueues.start):
+        * BuildSlaveSupport/ews-build/steps_unittest.py:
+        (test_skip_for_mac_wk2_passed_patch_on_commit_queue): Added unit-tests.
+        * BuildSlaveSupport/ews-build/factories.py: Added build-step to check the patch status on other queues.
+        * BuildSlaveSupport/ews-build/factories_unittest.py: Updated unit-test.
+        * BuildSlaveSupport/ews-app/ews/views/statusbubble.py: Added the new step status to STEPS_TO_HIDE.
+
+2020-03-20  Aakash Jain  <[email protected]>
+
         [ews] Better organize patch status api data
         https://bugs.webkit.org/show_bug.cgi?id=209342
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to