Title: [257848] trunk/Tools
Revision
257848
Author
[email protected]
Date
2020-03-04 09:40:21 -0800 (Wed, 04 Mar 2020)

Log Message

[ews] Add build step to create local git commit for commit-queue
https://bugs.webkit.org/show_bug.cgi?id=208539

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/steps.py:
(CreateLocalGITCommit): Build step to create local git commit.
(CreateLocalGITCommit.start):
(CreateLocalGITCommit.getResultSummary): Set custom failure message.
* BuildSlaveSupport/ews-build/steps_unittest.py: Added unit-tests and restructured imports.
* BuildSlaveSupport/ews-build/factories.py:

Modified Paths

Diff

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


--- trunk/Tools/BuildSlaveSupport/ews-build/factories.py	2020-03-04 16:53:55 UTC (rev 257847)
+++ trunk/Tools/BuildSlaveSupport/ews-build/factories.py	2020-03-04 17:40:21 UTC (rev 257848)
@@ -25,7 +25,7 @@
 from buildbot.steps import trigger
 
 from steps import (ApplyPatch, ApplyWatchList, CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance,
-                   CheckStyle, CompileJSC, CompileWebKit, ConfigureBuild,
+                   CheckStyle, CompileJSC, CompileWebKit, ConfigureBuild, CreateLocalGITCommit,
                    DownloadBuiltProduct, ExtractBuiltProduct, FindModifiedChangeLogs, InstallGtkDependencies,
                    InstallWpeDependencies, KillOldProcesses, PrintConfiguration, RunAPITests, RunBindingsTests,
                    RunBuildWebKitOrgUnitTests, RunEWSBuildbotCheckConfig, RunEWSUnitTests, RunResultsdbpyTests,
@@ -226,3 +226,4 @@
         self.addStep(UpdateWorkingDirectory())
         self.addStep(ApplyPatch())
         self.addStep(FindModifiedChangeLogs())
+        self.addStep(CreateLocalGITCommit())

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


--- trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2020-03-04 16:53:55 UTC (rev 257847)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2020-03-04 17:40:21 UTC (rev 257848)
@@ -2459,3 +2459,33 @@
             if self.is_path_to_changelog(filename):
                 filenames.append(filename)
         return filenames
+
+
+class CreateLocalGITCommit(shell.ShellCommand):
+    name = 'create-local-git-commit'
+    descriptionDone = ['Created local git commit']
+    command = ['git', 'commit', '--all', '-F']
+    haltOnFailure = True
+
+    def __init__(self, **kwargs):
+        shell.ShellCommand.__init__(self, timeout=5 * 60, logEnviron=False, **kwargs)
+
+    def start(self):
+        self.failure_message = None
+        modified_changelogs = self.getProperty('modified_changelogs')
+        if not modified_changelogs:
+            self.failure_message = u'No modified ChangeLog file found'
+            self.finished(FAILURE)
+            return None
+
+        modified_changelogs = ' '.join(modified_changelogs)
+        self.command = 'perl Tools/Scripts/commit-log-editor --print-log {}'.format(modified_changelogs)
+        self.command += ' | git commit --all -F -'
+        return shell.ShellCommand.start(self)
+
+    def getResultSummary(self):
+        if self.failure_message:
+            return {u'step': self.failure_message}
+        if self.results != SUCCESS:
+            return {u'step': u'Failed to create git commit'}
+        return shell.ShellCommand.getResultSummary(self)

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


--- trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py	2020-03-04 16:53:55 UTC (rev 257847)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py	2020-03-04 17:40:21 UTC (rev 257848)
@@ -34,14 +34,19 @@
 from twisted.python import failure, log
 from twisted.trial import unittest
 
-from steps import (AnalyzeAPITestsResults, AnalyzeCompileWebKitResults, AnalyzeJSCTestsResults, AnalyzeLayoutTestsResults, ApplyPatch, ApplyWatchList, ArchiveBuiltProduct, ArchiveTestResults,
-                   CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance, CheckStyle, CleanBuild, CleanUpGitIndexLock, CleanWorkingDirectory,
-                   CompileJSC, CompileJSCToT, CompileWebKit, CompileWebKitToT, ConfigureBuild,
-                   DownloadBuiltProduct, DownloadBuiltProductFromMaster, ExtractBuiltProduct, ExtractTestResults, FindModifiedChangeLogs, InstallGtkDependencies, InstallWpeDependencies, KillOldProcesses,
-                   PrintConfiguration, ReRunAPITests, ReRunJavaScriptCoreTests, ReRunWebKitPerlTests, ReRunWebKitTests, RunAPITests, RunAPITestsWithoutPatch,
-                   RunBindingsTests, RunBuildWebKitOrgUnitTests, RunEWSBuildbotCheckConfig, RunEWSUnitTests, RunResultsdbpyTests, RunJavaScriptCoreTests, RunJSCTestsWithoutPatch, RunWebKit1Tests,
-                   RunWebKitPerlTests, RunWebKitPyPython2Tests, RunWebKitPyPython3Tests, RunWebKitTests, RunWebKitTestsWithoutPatch, TestWithFailureCount, Trigger, TransferToS3, UnApplyPatchIfRequired,
-                   UpdateWorkingDirectory, UploadBuiltProduct, UploadTestResults, ValidatePatch)
+from steps import (AnalyzeAPITestsResults, AnalyzeCompileWebKitResults, AnalyzeJSCTestsResults,
+                   AnalyzeLayoutTestsResults, ApplyPatch, ApplyWatchList, ArchiveBuiltProduct, ArchiveTestResults,
+                   CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance, CheckStyle, CleanBuild,
+                   CleanUpGitIndexLock, CleanWorkingDirectory, CompileJSC, CompileJSCToT, CompileWebKit,
+                   CompileWebKitToT, ConfigureBuild, CreateLocalGITCommit,
+                   DownloadBuiltProduct, DownloadBuiltProductFromMaster, ExtractBuiltProduct, ExtractTestResults,
+                   FindModifiedChangeLogs, InstallGtkDependencies, InstallWpeDependencies, KillOldProcesses,
+                   PrintConfiguration, ReRunAPITests, ReRunJavaScriptCoreTests, ReRunWebKitPerlTests, ReRunWebKitTests,
+                   RunAPITests, RunAPITestsWithoutPatch, RunBindingsTests, RunBuildWebKitOrgUnitTests,
+                   RunEWSBuildbotCheckConfig, RunEWSUnitTests, RunResultsdbpyTests, RunJavaScriptCoreTests,
+                   RunJSCTestsWithoutPatch, RunWebKit1Tests, RunWebKitPerlTests, RunWebKitPyPython2Tests,
+                   RunWebKitPyPython3Tests, RunWebKitTests, RunWebKitTestsWithoutPatch, TestWithFailureCount,
+                   Trigger, TransferToS3, UnApplyPatchIfRequired, UpdateWorkingDirectory, UploadBuiltProduct, UploadTestResults, ValidatePatch)
 
 # Workaround for https://github.com/buildbot/buildbot/issues/4669
 from buildbot.test.fake.fakebuild import FakeBuild
@@ -3060,7 +3065,6 @@
 
     def test_failure(self):
         self.setupStep(FindModifiedChangeLogs())
-        self.setProperty('bug_id', '1234')
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
                         timeout=180,
@@ -3073,5 +3077,46 @@
         return self.runStep()
 
 
+class TestCreateLocalGITCommit(BuildStepMixinAdditions, unittest.TestCase):
+    def setUp(self):
+        self.longMessage = True
+        return self.setUpBuildStep()
+
+    def tearDown(self):
+        return self.tearDownBuildStep()
+
+    def test_success(self):
+        self.setupStep(CreateLocalGITCommit())
+        self.setProperty('modified_changelogs', ['Tools/Scripts/ChangeLog', 'Source/WebCore/ChangeLog'])
+        self.expectRemoteCommands(
+            ExpectShell(workdir='wkdir',
+                        timeout=300,
+                        logEnviron=False,
+                        command='perl Tools/Scripts/commit-log-editor --print-log Tools/Scripts/ChangeLog Source/WebCore/ChangeLog | git commit --all -F -') +
+            0,
+        )
+        self.expectOutcome(result=SUCCESS, state_string='Created local git commit')
+        return self.runStep()
+
+    def test_failure_no_changelog(self):
+        self.setupStep(CreateLocalGITCommit())
+        self.expectOutcome(result=FAILURE, state_string='No modified ChangeLog file found')
+        return self.runStep()
+
+    def test_failure(self):
+        self.setupStep(CreateLocalGITCommit())
+        self.setProperty('modified_changelogs', ['Tools/Scripts/ChangeLog'])
+        self.expectRemoteCommands(
+            ExpectShell(workdir='wkdir',
+                        timeout=300,
+                        logEnviron=False,
+                        command='perl Tools/Scripts/commit-log-editor --print-log Tools/Scripts/ChangeLog | git commit --all -F -') +
+            ExpectShell.log('stdio', stdout='Unexpected failure') +
+            2,
+        )
+        self.expectOutcome(result=FAILURE, state_string='Failed to create git commit')
+        return self.runStep()
+
+
 if __name__ == '__main__':
     unittest.main()

Modified: trunk/Tools/ChangeLog (257847 => 257848)


--- trunk/Tools/ChangeLog	2020-03-04 16:53:55 UTC (rev 257847)
+++ trunk/Tools/ChangeLog	2020-03-04 17:40:21 UTC (rev 257848)
@@ -1,3 +1,17 @@
+2020-03-04  Aakash Jain  <[email protected]>
+
+        [ews] Add build step to create local git commit for commit-queue
+        https://bugs.webkit.org/show_bug.cgi?id=208539
+
+        Reviewed by Jonathan Bedard.
+
+        * BuildSlaveSupport/ews-build/steps.py:
+        (CreateLocalGITCommit): Build step to create local git commit.
+        (CreateLocalGITCommit.start):
+        (CreateLocalGITCommit.getResultSummary): Set custom failure message.
+        * BuildSlaveSupport/ews-build/steps_unittest.py: Added unit-tests and restructured imports.
+        * BuildSlaveSupport/ews-build/factories.py:
+
 2020-03-04  Simon Fraser  <[email protected]>
 
         (r256513) [ Mac ] fast/scrolling/programmatic-scroll-to-zero-zero.html is a flaky failure
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to