Title: [275624] trunk/Tools
Revision
275624
Author
aakash_j...@apple.com
Date
2021-04-07 14:00:24 -0700 (Wed, 07 Apr 2021)

Log Message

commit-queue should perform git reset --hard between retry attempts
https://bugs.webkit.org/show_bug.cgi?id=224300

Reviewed by Jonathan Bedard.

* CISupport/ews-build/steps.py:
(GitResetHard): Build step to perform git reset --hard.
(GitResetHard.start):
(PushCommitToWebKitRepo.evaluateCommand):
* CISupport/ews-build/steps_unittest.py: Added unit-test.

Modified Paths

Diff

Modified: trunk/Tools/CISupport/ews-build/steps.py (275623 => 275624)


--- trunk/Tools/CISupport/ews-build/steps.py	2021-04-07 20:07:14 UTC (rev 275623)
+++ trunk/Tools/CISupport/ews-build/steps.py	2021-04-07 21:00:24 UTC (rev 275624)
@@ -169,6 +169,18 @@
         return shell.ShellCommand.start(self)
 
 
+class GitResetHard(shell.ShellCommand):
+    name = 'git-reset-hard'
+    descriptionDone = ['Performed git reset --hard']
+
+    def __init__(self, **kwargs):
+        super(GitResetHard, self).__init__(logEnviron=False, **kwargs)
+
+    def start(self):
+        self.setCommand(['git', 'reset', 'HEAD~10', '--hard'])
+        return shell.ShellCommand.start(self)
+
+
 class FetchBranches(shell.ShellCommand):
     name = 'fetch-branch-references'
     descriptionDone = ['Updated branch information']
@@ -3271,7 +3283,7 @@
             retry_count = int(self.getProperty('retry_count', 0))
             if retry_count < self.MAX_RETRY:
                 self.setProperty('retry_count', retry_count + 1)
-                self.build.addStepsAfterCurrentStep([CheckOutSource(), ShowIdentifier(), UpdateWorkingDirectory(), ApplyPatch(), CreateLocalGITCommit(), PushCommitToWebKitRepo()])
+                self.build.addStepsAfterCurrentStep([GitResetHard(), CheckOutSource(), ShowIdentifier(), UpdateWorkingDirectory(), ApplyPatch(), CreateLocalGITCommit(), PushCommitToWebKitRepo()])
                 return rc
 
             self.setProperty('bugzilla_comment_text', self.comment_text_for_bug())

Modified: trunk/Tools/CISupport/ews-build/steps_unittest.py (275623 => 275624)


--- trunk/Tools/CISupport/ews-build/steps_unittest.py	2021-04-07 20:07:14 UTC (rev 275623)
+++ trunk/Tools/CISupport/ews-build/steps_unittest.py	2021-04-07 21:00:24 UTC (rev 275624)
@@ -46,7 +46,7 @@
                    CleanBuild, CleanUpGitIndexLock, CleanWorkingDirectory, CompileJSC, CompileJSCWithoutPatch, CompileWebKit,
                    CompileWebKitWithoutPatch, ConfigureBuild, CreateLocalGITCommit,
                    DownloadBuiltProduct, DownloadBuiltProductFromMaster, EWS_BUILD_HOSTNAME, ExtractBuiltProduct, ExtractTestResults,
-                   FetchBranches, FindModifiedChangeLogs, FindModifiedLayoutTests, InstallGtkDependencies, InstallWpeDependencies,
+                   FetchBranches, FindModifiedChangeLogs, FindModifiedLayoutTests, GitResetHard, InstallGtkDependencies, InstallWpeDependencies,
                    KillOldProcesses, PrintConfiguration, PushCommitToWebKitRepo, ReRunAPITests, ReRunJavaScriptCoreTests, ReRunWebKitPerlTests,
                    ReRunWebKitTests, RunAPITests, RunAPITestsWithoutPatch, RunBindingsTests, RunBuildWebKitOrgUnitTests,
                    RunBuildbotCheckConfigForBuildWebKit, RunBuildbotCheckConfigForEWS, RunEWSUnitTests, RunResultsdbpyTests,
@@ -839,6 +839,40 @@
         return self.runStep()
 
 
+class TestGitResetHard(BuildStepMixinAdditions, unittest.TestCase):
+    def setUp(self):
+        self.longMessage = True
+        return self.setUpBuildStep()
+
+    def tearDown(self):
+        return self.tearDownBuildStep()
+
+    def test_success(self):
+        self.setupStep(GitResetHard())
+        self.expectRemoteCommands(
+            ExpectShell(workdir='wkdir',
+                        command=['git', 'reset', 'HEAD~10', '--hard'],
+                        logEnviron=False,
+                        )
+            + 0,
+        )
+        self.expectOutcome(result=SUCCESS, state_string='Performed git reset --hard')
+        return self.runStep()
+
+    def test_failure(self):
+        self.setupStep(GitResetHard())
+        self.expectRemoteCommands(
+            ExpectShell(workdir='wkdir',
+                        command=['git', 'reset', 'HEAD~10', '--hard'],
+                        logEnviron=False,
+                        )
+            + ExpectShell.log('stdio', stdout='Unexpected error.')
+            + 2,
+        )
+        self.expectOutcome(result=FAILURE, state_string='Performed git reset --hard (failure)')
+        return self.runStep()
+
+
 class TestCleanBuild(BuildStepMixinAdditions, unittest.TestCase):
     def setUp(self):
         self.longMessage = True

Modified: trunk/Tools/ChangeLog (275623 => 275624)


--- trunk/Tools/ChangeLog	2021-04-07 20:07:14 UTC (rev 275623)
+++ trunk/Tools/ChangeLog	2021-04-07 21:00:24 UTC (rev 275624)
@@ -1,3 +1,16 @@
+2021-04-07  Aakash Jain  <aakash_j...@apple.com>
+
+        commit-queue should perform git reset --hard between retry attempts
+        https://bugs.webkit.org/show_bug.cgi?id=224300
+
+        Reviewed by Jonathan Bedard.
+
+        * CISupport/ews-build/steps.py:
+        (GitResetHard): Build step to perform git reset --hard.
+        (GitResetHard.start):
+        (PushCommitToWebKitRepo.evaluateCommand):
+        * CISupport/ews-build/steps_unittest.py: Added unit-test.
+
 2021-04-07  Jonathan Bedard  <jbed...@apple.com>
 
         [build.webkit.org] Commit queue should post the identifier
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to