Title: [277395] trunk/Tools
Revision
277395
Author
[email protected]
Date
2021-05-12 15:07:49 -0700 (Wed, 12 May 2021)

Log Message

[build.webkit.org] Bots should automatically recover from svn checkout is already locked issue
https://bugs.webkit.org/show_bug.cgi?id=225717

Reviewed by Jonathan Bedard.

* CISupport/build-webkit-org/steps.py:
(CheckOutSource): Set haltOnFailure to False so that cleanup step can run. Also set the step name while we are at it.
(CheckOutSource.__init__): Also set logEnviron to False.
(CheckOutSource.getResultSummary): Run SVNCleanup step in case of failure.
(SVNCleanup):
(SVNCleanup.__init__):
(SVNCleanup.evaluateCommand):
* CISupport/build-webkit-org/steps_unittest.py: Added unit-tests for the new step.

Modified Paths

Diff

Modified: trunk/Tools/CISupport/build-webkit-org/steps.py (277394 => 277395)


--- trunk/Tools/CISupport/build-webkit-org/steps.py	2021-05-12 22:02:32 UTC (rev 277394)
+++ trunk/Tools/CISupport/build-webkit-org/steps.py	2021-05-12 22:07:49 UTC (rev 277395)
@@ -21,7 +21,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 from buildbot.process import buildstep, factory, logobserver, properties
-from buildbot.process.results import Results, SUCCESS, FAILURE, WARNINGS, SKIPPED, EXCEPTION
+from buildbot.process.results import Results, SUCCESS, FAILURE, WARNINGS, SKIPPED, EXCEPTION, RETRY
 from buildbot.steps import master, shell, transfer, trigger
 from buildbot.steps.source.svn import SVN
 
@@ -130,12 +130,38 @@
 
 
 class CheckOutSource(SVN, object):
+    name = 'clean-and-update-working-directory'
+    haltOnFailure = False
+
     def __init__(self, **kwargs):
         kwargs['repourl'] = 'https://svn.webkit.org/repository/webkit/trunk'
         kwargs['mode'] = 'incremental'
+        kwargs['logEnviron'] = False
         super(CheckOutSource, self).__init__(**kwargs)
 
+    def getResultSummary(self):
+        if self.results == FAILURE:
+            self.build.addStepsAfterCurrentStep([SVNCleanup()])
 
+        if self.results != SUCCESS:
+            return {'step': 'Failed to updated working directory'}
+        else:
+            return {'step': 'Cleaned and updated working directory'}
+
+
+class SVNCleanup(shell.ShellCommand):
+    name = 'svn-cleanup'
+    command = ['svn', 'cleanup']
+    descriptionDone = ['Run svn cleanup']
+
+    def __init__(self, **kwargs):
+        super(SVNCleanup, self).__init__(timeout=10 * 60, logEnviron=False, **kwargs)
+
+    def evaluateCommand(self, cmd):
+        self.build.buildFinished(['svn issue, retrying build'], RETRY)
+        return super(SVNCleanup, self).evaluateCommand(cmd)
+
+
 class InstallWin32Dependencies(shell.Compile):
     description = ["installing dependencies"]
     descriptionDone = ["installed dependencies"]

Modified: trunk/Tools/CISupport/build-webkit-org/steps_unittest.py (277394 => 277395)


--- trunk/Tools/CISupport/build-webkit-org/steps_unittest.py	2021-05-12 22:02:32 UTC (rev 277394)
+++ trunk/Tools/CISupport/build-webkit-org/steps_unittest.py	2021-05-12 22:07:49 UTC (rev 277395)
@@ -991,3 +991,39 @@
         )
         self.expectOutcome(result=FAILURE, state_string='failed (1) (failure)')
         return self.runStep()
+
+
+class TestSVNCleanup(BuildStepMixinAdditions, unittest.TestCase):
+    def setUp(self):
+        self.longMessage = True
+        return self.setUpBuildStep()
+
+    def tearDown(self):
+        return self.tearDownBuildStep()
+
+    def test_success(self):
+        self.setupStep(SVNCleanup())
+        self.expectRemoteCommands(
+            ExpectShell(
+                workdir='wkdir',
+                timeout=600,
+                logEnviron=False,
+                command=['svn', 'cleanup'],
+            ) + 0,
+        )
+        self.expectOutcome(result=SUCCESS, state_string='Run svn cleanup')
+        return self.runStep()
+
+    def test_failure(self):
+        self.setupStep(SVNCleanup())
+        self.expectRemoteCommands(
+            ExpectShell(
+                workdir='wkdir',
+                timeout=600,
+                logEnviron=False,
+                command=['svn', 'cleanup'],
+            ) + 2
+            + ExpectShell.log('stdio', stdout='Unexpected error.'),
+        )
+        self.expectOutcome(result=FAILURE, state_string='Run svn cleanup (failure)')
+        return self.runStep()

Modified: trunk/Tools/ChangeLog (277394 => 277395)


--- trunk/Tools/ChangeLog	2021-05-12 22:02:32 UTC (rev 277394)
+++ trunk/Tools/ChangeLog	2021-05-12 22:07:49 UTC (rev 277395)
@@ -1,3 +1,19 @@
+2021-05-12  Aakash Jain  <[email protected]>
+
+        [build.webkit.org] Bots should automatically recover from svn checkout is already locked issue
+        https://bugs.webkit.org/show_bug.cgi?id=225717
+
+        Reviewed by Jonathan Bedard.
+
+        * CISupport/build-webkit-org/steps.py:
+        (CheckOutSource): Set haltOnFailure to False so that cleanup step can run. Also set the step name while we are at it.
+        (CheckOutSource.__init__): Also set logEnviron to False.
+        (CheckOutSource.getResultSummary): Run SVNCleanup step in case of failure.
+        (SVNCleanup):
+        (SVNCleanup.__init__):
+        (SVNCleanup.evaluateCommand):
+        * CISupport/build-webkit-org/steps_unittest.py: Added unit-tests for the new step.
+
 2021-05-12  Chris Dumez  <[email protected]>
 
         Unreviewed follow-up to r277376.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to