Title: [246651] trunk/Tools
Revision
246651
Author
aakash_j...@apple.com
Date
2019-06-20 13:35:57 -0700 (Thu, 20 Jun 2019)

Log Message

[ews-build] Triggered builds should use same revision as parent build
https://bugs.webkit.org/show_bug.cgi?id=198289

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/steps.py:
(CheckOutSpecificRevision): Build step to checkout specific revision.
(CheckOutSpecificRevision.doStepIf): Run this step only if ews_revision property is set.
(CheckOutSpecificRevision.hideStepIf): Hide this step when it is skipped.
(CheckOutSpecificRevision.start): Run appropriate git command.
(Trigger.propertiesToPassToTriggers): Pass ews_revision property to triggered builds, so that triggered
builds use same revision as parent build.
* BuildSlaveSupport/ews-build/steps_unittest.py: Added unit-tests.
* BuildSlaveSupport/ews-build/factories.py:
(Factory.__init__): Added CheckOutSpecificRevision step.

Modified Paths

Diff

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


--- trunk/Tools/BuildSlaveSupport/ews-build/factories.py	2019-06-20 20:24:30 UTC (rev 246650)
+++ trunk/Tools/BuildSlaveSupport/ews-build/factories.py	2019-06-20 20:35:57 UTC (rev 246651)
@@ -24,8 +24,8 @@
 from buildbot.process import factory
 from buildbot.steps import trigger
 
-from steps import (ApplyPatch, CheckOutSource, CheckPatchRelevance, CheckStyle,
-                   CompileJSCOnly, CompileJSCOnlyToT, CompileWebKit, ConfigureBuild,
+from steps import (ApplyPatch, CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance,
+                   CheckStyle, CompileJSCOnly, CompileJSCOnlyToT, CompileWebKit, ConfigureBuild,
                    DownloadBuiltProduct, ExtractBuiltProduct, KillOldProcesses,
                    PrintConfiguration, ReRunJavaScriptCoreTests, RunAPITests, RunBindingsTests,
                    RunJavaScriptCoreTests, RunJavaScriptCoreTestsToT, RunWebKit1Tests, RunWebKitPerlTests,
@@ -41,6 +41,10 @@
         self.addStep(ValidatePatch())
         self.addStep(PrintConfiguration())
         self.addStep(CheckOutSource())
+        # CheckOutSource step pulls the latest revision, since we use alwaysUseLatest=True. Without alwaysUseLatest Buildbot will
+        # automatically apply the patch to the repo, and that doesn't handle ChangeLogs well. See https://webkit.org/b/193138
+        # Therefore we add CheckOutSpecificRevision step to checkout required revision.
+        self.addStep(CheckOutSpecificRevision())
         self.addStep(ApplyPatch())
 
 

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


--- trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2019-06-20 20:24:30 UTC (rev 246650)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2019-06-20 20:35:57 UTC (rev 246651)
@@ -107,6 +107,23 @@
             return {u'step': u'Cleaned and updated working directory'}
 
 
+class CheckOutSpecificRevision(shell.ShellCommand):
+    name = 'checkout-specific-revision'
+    descriptionDone = ['Checked out required revision']
+    flunkOnFailure = False
+    haltOnFailure = False
+
+    def doStepIf(self, step):
+        return self.getProperty('ews_revision', False)
+
+    def hideStepIf(self, results, step):
+        return not self.doStepIf(step)
+
+    def start(self):
+        self.setCommand(['git', 'checkout', self.getProperty('ews_revision')])
+        return shell.ShellCommand.start(self)
+
+
 class CleanWorkingDirectory(shell.ShellCommand):
     name = 'clean-working-directory'
     description = ['clean-working-directory running']
@@ -404,6 +421,7 @@
             'fullPlatform': properties.Property('fullPlatform'),
             'architecture': properties.Property('architecture'),
             'owner': properties.Property('owner'),
+            'ews_revision': properties.Property('got_revision'),
         }
 
 

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


--- trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py	2019-06-20 20:24:30 UTC (rev 246650)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py	2019-06-20 20:35:57 UTC (rev 246651)
@@ -35,7 +35,7 @@
 from twisted.trial import unittest
 
 from steps import (AnalyzeAPITestsResults, AnalyzeCompileWebKitResults, ApplyPatch, ArchiveBuiltProduct, ArchiveTestResults,
-                   CheckOutSource, CheckPatchRelevance, CheckStyle, CleanBuild, CleanWorkingDirectory,
+                   CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance, CheckStyle, CleanBuild, CleanWorkingDirectory,
                    CompileJSCOnly, CompileJSCOnlyToT, CompileWebKit, CompileWebKitToT, ConfigureBuild,
                    DownloadBuiltProduct, ExtractBuiltProduct, ExtractTestResults, KillOldProcesses,
                    PrintConfiguration, ReRunAPITests, ReRunJavaScriptCoreTests, RunAPITests, RunAPITestsWithoutPatch,
@@ -870,6 +870,50 @@
         return self.runStep()
 
 
+class TestCheckOutSpecificRevision(BuildStepMixinAdditions, unittest.TestCase):
+    def setUp(self):
+        self.longMessage = True
+        return self.setUpBuildStep()
+
+    def tearDown(self):
+        return self.tearDownBuildStep()
+
+    def test_success(self):
+        self.setupStep(CheckOutSpecificRevision())
+        self.setProperty('ews_revision', '1a3425cb92dbcbca12a10aa9514f1b77c76dc26')
+        self.expectHidden(False)
+        self.expectRemoteCommands(
+            ExpectShell(workdir='wkdir',
+                        timeout=1200,
+                        command=['git', 'checkout', '1a3425cb92dbcbca12a10aa9514f1b77c76dc26'],
+                        )
+            + 0,
+        )
+        self.expectOutcome(result=SUCCESS, state_string='Checked out required revision')
+        return self.runStep()
+
+    def test_failure(self):
+        self.setupStep(CheckOutSpecificRevision())
+        self.setProperty('ews_revision', '1a3425cb92dbcbca12a10aa9514f1b77c76dc26')
+        self.expectHidden(False)
+        self.expectRemoteCommands(
+            ExpectShell(workdir='wkdir',
+                        timeout=1200,
+                        command=['git', 'checkout', '1a3425cb92dbcbca12a10aa9514f1b77c76dc26'],
+                        )
+            + ExpectShell.log('stdio', stdout='Unexpected failure')
+            + 2,
+        )
+        self.expectOutcome(result=FAILURE, state_string='Checked out required revision (failure)')
+        return self.runStep()
+
+    def test_skip(self):
+        self.setupStep(CheckOutSpecificRevision())
+        self.expectHidden(True)
+        self.expectOutcome(result=SKIPPED, state_string='Checked out required revision (skipped)')
+        return self.runStep()
+
+
 class TestCleanWorkingDirectory(BuildStepMixinAdditions, unittest.TestCase):
     def setUp(self):
         self.longMessage = True

Modified: trunk/Tools/ChangeLog (246650 => 246651)


--- trunk/Tools/ChangeLog	2019-06-20 20:24:30 UTC (rev 246650)
+++ trunk/Tools/ChangeLog	2019-06-20 20:35:57 UTC (rev 246651)
@@ -1,5 +1,23 @@
 2019-06-20  Aakash Jain  <aakash_j...@apple.com>
 
+        [ews-build] Triggered builds should use same revision as parent build
+        https://bugs.webkit.org/show_bug.cgi?id=198289
+
+        Reviewed by Jonathan Bedard.
+
+        * BuildSlaveSupport/ews-build/steps.py:
+        (CheckOutSpecificRevision): Build step to checkout specific revision.
+        (CheckOutSpecificRevision.doStepIf): Run this step only if ews_revision property is set.
+        (CheckOutSpecificRevision.hideStepIf): Hide this step when it is skipped.
+        (CheckOutSpecificRevision.start): Run appropriate git command.
+        (Trigger.propertiesToPassToTriggers): Pass ews_revision property to triggered builds, so that triggered
+        builds use same revision as parent build.
+        * BuildSlaveSupport/ews-build/steps_unittest.py: Added unit-tests.
+        * BuildSlaveSupport/ews-build/factories.py:
+        (Factory.__init__): Added CheckOutSpecificRevision step.
+
+2019-06-20  Aakash Jain  <aakash_j...@apple.com>
+
         [ews-build] Add unit tests for AnalyzeCompileWebKitResults
         https://bugs.webkit.org/show_bug.cgi?id=199073
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to