Modified: trunk/Tools/CISupport/ews-build/factories.py (275852 => 275853)
--- trunk/Tools/CISupport/ews-build/factories.py 2021-04-13 00:47:20 UTC (rev 275852)
+++ trunk/Tools/CISupport/ews-build/factories.py 2021-04-13 00:48:17 UTC (rev 275853)
@@ -25,7 +25,7 @@
from buildbot.steps import trigger
from steps import (ApplyPatch, ApplyWatchList, CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance,
- CheckPatchStatusOnEWSQueues, CheckStyle, CompileJSC, CompileWebKit, ConfigureBuild, CreateLocalGITCommit,
+ CheckPatchStatusOnEWSQueues, CheckStyle, CleanGitRepo, CompileJSC, CompileWebKit, ConfigureBuild, CreateLocalGITCommit,
DownloadBuiltProduct, ExtractBuiltProduct, FetchBranches, FindModifiedChangeLogs, FindModifiedLayoutTests,
InstallGtkDependencies, InstallWpeDependencies, KillOldProcesses, PrintConfiguration, PushCommitToWebKitRepo,
RunAPITests, RunBindingsTests, RunBuildWebKitOrgUnitTests, RunBuildbotCheckConfigForBuildWebKit, RunBuildbotCheckConfigForEWS,
@@ -281,6 +281,7 @@
self.addStep(ValidatePatch(verifycqplus=True))
self.addStep(ValidateCommiterAndReviewer())
self.addStep(PrintConfiguration())
+ self.addStep(CleanGitRepo())
self.addStep(CheckOutSource())
self.addStep(FetchBranches())
self.addStep(ShowIdentifier())
Modified: trunk/Tools/CISupport/ews-build/steps.py (275852 => 275853)
--- trunk/Tools/CISupport/ews-build/steps.py 2021-04-13 00:47:20 UTC (rev 275852)
+++ trunk/Tools/CISupport/ews-build/steps.py 2021-04-13 00:48:17 UTC (rev 275853)
@@ -3128,6 +3128,31 @@
return {'step': configuration}
+class CleanGitRepo(steps.ShellSequence):
+ name = 'clean-up-git-repo'
+ haltOnFailure = False
+ flunkOnFailure = False
+ logEnviron = False
+ # This somewhat quirky sequence of steps seems to clear up all the broken
+ # git situations we've gotten ourself into in the past.
+ command_list = [['git', 'clean', '-f'], # Remove any left-over layout test results, added files, etc.
+ ['git', 'fetch', 'origin'], # Avoid updating the working copy to a stale revision.
+ ['git', 'checkout', 'origin/main', '-f'],
+ ['git', 'branch', '-D', 'main'],
+ ['git', 'checkout', 'origin/main', '-b', 'main']]
+
+ def run(self):
+ self.commands = []
+ for command in self.command_list:
+ self.commands.append(util.ShellArg(command=command, logname='stdio'))
+ return super(CleanGitRepo, self).run()
+
+ def getResultSummary(self):
+ if self.results != SUCCESS:
+ return {'step': 'Encountered some issues during cleanup'}
+ return {'step': 'Cleaned up git repository'}
+
+
class ApplyWatchList(shell.ShellCommand):
name = 'apply-watch-list'
description = ['applying watchilist']
Modified: trunk/Tools/CISupport/ews-build/steps_unittest.py (275852 => 275853)
--- trunk/Tools/CISupport/ews-build/steps_unittest.py 2021-04-13 00:47:20 UTC (rev 275852)
+++ trunk/Tools/CISupport/ews-build/steps_unittest.py 2021-04-13 00:48:17 UTC (rev 275853)
@@ -43,8 +43,8 @@
from steps import (AnalyzeAPITestsResults, AnalyzeCompileWebKitResults, AnalyzeJSCTestsResults,
AnalyzeLayoutTestsResults, ApplyPatch, ApplyWatchList, ArchiveBuiltProduct, ArchiveTestResults,
CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance, CheckPatchStatusOnEWSQueues, CheckStyle,
- CleanBuild, CleanUpGitIndexLock, CleanWorkingDirectory, CompileJSC, CompileJSCWithoutPatch, CompileWebKit,
- CompileWebKitWithoutPatch, ConfigureBuild, CreateLocalGITCommit,
+ CleanBuild, CleanUpGitIndexLock, CleanGitRepo, CleanWorkingDirectory, CompileJSC, CompileJSCWithoutPatch,
+ CompileWebKit, CompileWebKitWithoutPatch, ConfigureBuild, CreateLocalGITCommit,
DownloadBuiltProduct, DownloadBuiltProductFromMaster, EWS_BUILD_HOSTNAME, ExtractBuiltProduct, ExtractTestResults,
FetchBranches, FindModifiedChangeLogs, FindModifiedLayoutTests, GitResetHard, InstallGtkDependencies, InstallWpeDependencies,
KillOldProcesses, PrintConfiguration, PushCommitToWebKitRepo, ReRunAPITests, ReRunJavaScriptCoreTests, ReRunWebKitPerlTests,
@@ -3889,6 +3889,53 @@
return self.runStep()
+class TestCleanGitRepo(BuildStepMixinAdditions, unittest.TestCase):
+ def setUp(self):
+ self.longMessage = True
+ return self.setUpBuildStep()
+
+ def tearDown(self):
+ return self.tearDownBuildStep()
+
+ def test_success(self):
+ self.setupStep(CleanGitRepo())
+ self.setProperty('buildername', 'Commit-Queue')
+
+ self.expectRemoteCommands(
+ ExpectShell(command=['git', 'clean', '-f'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout=''),
+ ExpectShell(command=['git', 'fetch', 'origin'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout=''),
+ ExpectShell(command=['git', 'checkout', 'origin/main', '-f'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='You are in detached HEAD state.'),
+ ExpectShell(command=['git', 'branch', '-D', 'main'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='Deleted branch main (was 57015967fef9).'),
+ ExpectShell(command=['git', 'checkout', 'origin/main', '-b', 'main'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout="Switched to a new branch 'main'"),
+ )
+ self.expectOutcome(result=SUCCESS, state_string='Cleaned up git repository')
+ return self.runStep()
+
+ def test_failure(self):
+ self.setupStep(CleanGitRepo())
+ self.setProperty('buildername', 'Commit-Queue')
+
+ self.expectRemoteCommands(
+ ExpectShell(command=['git', 'clean', '-f'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout=''),
+ ExpectShell(command=['git', 'fetch', 'origin'], workdir='wkdir', timeout=1200, logEnviron=False) + 128
+ + ExpectShell.log('stdio', stdout='fatal: unable to access https://github.com/WebKit/WebKit.git/: Could not resolve host: github.com'),
+ ExpectShell(command=['git', 'checkout', 'origin/main', '-f'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='You are in detached HEAD state.'),
+ ExpectShell(command=['git', 'branch', '-D', 'main'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='Deleted branch main (was 57015967fef9).'),
+ ExpectShell(command=['git', 'checkout', 'origin/main', '-b', 'main'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout="Switched to a new branch 'main'"),
+ )
+ self.expectOutcome(result=FAILURE, state_string='Encountered some issues during cleanup')
+ return self.runStep()
+
+
class TestFindModifiedChangeLogs(BuildStepMixinAdditions, unittest.TestCase):
def setUp(self):
self.longMessage = True