Changeset 275853 in webkit


Ignore:
Timestamp:
Apr 12, 2021 5:48:17 PM (3 years ago)
Author:
aakash_jain@apple.com
Message:

Make Commit Queue robust by adding few git commands to clean up repository
https://bugs.webkit.org/show_bug.cgi?id=224444

Reviewed by Jonathan Bedard.

  • CISupport/ews-build/steps.py:

(CleanGitRepo): Build step to run few commands to cleanup git repository.
(CleanGitRepo.run):
(CleanGitRepo.getResultSummary): Custom failure message.

  • CISupport/ews-build/steps_unittest.py: Added unit-tests.
  • CISupport/ews-build/factories.py:

(CommitQueueFactory.init):

  • CISupport/ews-build/factories_unittest.py:

(TestCommitQueueFactory.test_commit_queue_factory): Updated unit-test.

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/CISupport/ews-build/factories.py

    r275307 r275853  
    2626
    2727from steps import (ApplyPatch, ApplyWatchList, CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance,
    28                    CheckPatchStatusOnEWSQueues, CheckStyle, CompileJSC, CompileWebKit, ConfigureBuild, CreateLocalGITCommit,
     28                   CheckPatchStatusOnEWSQueues, CheckStyle, CleanGitRepo, CompileJSC, CompileWebKit, ConfigureBuild, CreateLocalGITCommit,
    2929                   DownloadBuiltProduct, ExtractBuiltProduct, FetchBranches, FindModifiedChangeLogs, FindModifiedLayoutTests,
    3030                   InstallGtkDependencies, InstallWpeDependencies, KillOldProcesses, PrintConfiguration, PushCommitToWebKitRepo,
     
    282282        self.addStep(ValidateCommiterAndReviewer())
    283283        self.addStep(PrintConfiguration())
     284        self.addStep(CleanGitRepo())
    284285        self.addStep(CheckOutSource())
    285286        self.addStep(FetchBranches())
  • trunk/Tools/CISupport/ews-build/factories_unittest.py

    r275307 r275853  
    412412            _BuildStepFactory(steps.ValidateCommiterAndReviewer),
    413413            _BuildStepFactory(steps.PrintConfiguration),
     414            _BuildStepFactory(steps.CleanGitRepo),
    414415            _BuildStepFactory(steps.CheckOutSource),
    415416            _BuildStepFactory(steps.FetchBranches),
  • trunk/Tools/CISupport/ews-build/steps.py

    r275795 r275853  
    31293129
    31303130
     3131class CleanGitRepo(steps.ShellSequence):
     3132    name = 'clean-up-git-repo'
     3133    haltOnFailure = False
     3134    flunkOnFailure = False
     3135    logEnviron = False
     3136    # This somewhat quirky sequence of steps seems to clear up all the broken
     3137    # git situations we've gotten ourself into in the past.
     3138    command_list = [['git', 'clean', '-f'],  # Remove any left-over layout test results, added files, etc.
     3139                    ['git', 'fetch', 'origin'],  # Avoid updating the working copy to a stale revision.
     3140                    ['git', 'checkout', 'origin/main', '-f'],
     3141                    ['git', 'branch', '-D', 'main'],
     3142                    ['git', 'checkout', 'origin/main', '-b', 'main']]
     3143
     3144    def run(self):
     3145        self.commands = []
     3146        for command in self.command_list:
     3147            self.commands.append(util.ShellArg(command=command, logname='stdio'))
     3148        return super(CleanGitRepo, self).run()
     3149
     3150    def getResultSummary(self):
     3151        if self.results != SUCCESS:
     3152            return {'step': 'Encountered some issues during cleanup'}
     3153        return {'step': 'Cleaned up git repository'}
     3154
     3155
    31313156class ApplyWatchList(shell.ShellCommand):
    31323157    name = 'apply-watch-list'
  • trunk/Tools/CISupport/ews-build/steps_unittest.py

    r275795 r275853  
    4444                   AnalyzeLayoutTestsResults, ApplyPatch, ApplyWatchList, ArchiveBuiltProduct, ArchiveTestResults,
    4545                   CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance, CheckPatchStatusOnEWSQueues, CheckStyle,
    46                    CleanBuild, CleanUpGitIndexLock, CleanWorkingDirectory, CompileJSC, CompileJSCWithoutPatch, CompileWebKit,
    47                    CompileWebKitWithoutPatch, ConfigureBuild, CreateLocalGITCommit,
     46                   CleanBuild, CleanUpGitIndexLock, CleanGitRepo, CleanWorkingDirectory, CompileJSC, CompileJSCWithoutPatch,
     47                   CompileWebKit, CompileWebKitWithoutPatch, ConfigureBuild, CreateLocalGITCommit,
    4848                   DownloadBuiltProduct, DownloadBuiltProductFromMaster, EWS_BUILD_HOSTNAME, ExtractBuiltProduct, ExtractTestResults,
    4949                   FetchBranches, FindModifiedChangeLogs, FindModifiedLayoutTests, GitResetHard, InstallGtkDependencies, InstallWpeDependencies,
     
    38903890
    38913891
     3892class TestCleanGitRepo(BuildStepMixinAdditions, unittest.TestCase):
     3893    def setUp(self):
     3894        self.longMessage = True
     3895        return self.setUpBuildStep()
     3896
     3897    def tearDown(self):
     3898        return self.tearDownBuildStep()
     3899
     3900    def test_success(self):
     3901        self.setupStep(CleanGitRepo())
     3902        self.setProperty('buildername', 'Commit-Queue')
     3903
     3904        self.expectRemoteCommands(
     3905            ExpectShell(command=['git', 'clean', '-f'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     3906            + ExpectShell.log('stdio', stdout=''),
     3907            ExpectShell(command=['git', 'fetch', 'origin'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     3908            + ExpectShell.log('stdio', stdout=''),
     3909            ExpectShell(command=['git', 'checkout', 'origin/main', '-f'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     3910            + ExpectShell.log('stdio', stdout='You are in detached HEAD state.'),
     3911            ExpectShell(command=['git', 'branch', '-D', 'main'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     3912            + ExpectShell.log('stdio', stdout='Deleted branch main (was 57015967fef9).'),
     3913            ExpectShell(command=['git', 'checkout', 'origin/main', '-b', 'main'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     3914            + ExpectShell.log('stdio', stdout="Switched to a new branch 'main'"),
     3915        )
     3916        self.expectOutcome(result=SUCCESS, state_string='Cleaned up git repository')
     3917        return self.runStep()
     3918
     3919    def test_failure(self):
     3920        self.setupStep(CleanGitRepo())
     3921        self.setProperty('buildername', 'Commit-Queue')
     3922
     3923        self.expectRemoteCommands(
     3924            ExpectShell(command=['git', 'clean', '-f'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     3925            + ExpectShell.log('stdio', stdout=''),
     3926            ExpectShell(command=['git', 'fetch', 'origin'], workdir='wkdir', timeout=1200, logEnviron=False) + 128
     3927            + ExpectShell.log('stdio', stdout='fatal: unable to access https://github.com/WebKit/WebKit.git/: Could not resolve host: github.com'),
     3928            ExpectShell(command=['git', 'checkout', 'origin/main', '-f'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     3929            + ExpectShell.log('stdio', stdout='You are in detached HEAD state.'),
     3930            ExpectShell(command=['git', 'branch', '-D', 'main'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     3931            + ExpectShell.log('stdio', stdout='Deleted branch main (was 57015967fef9).'),
     3932            ExpectShell(command=['git', 'checkout', 'origin/main', '-b', 'main'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     3933            + ExpectShell.log('stdio', stdout="Switched to a new branch 'main'"),
     3934        )
     3935        self.expectOutcome(result=FAILURE, state_string='Encountered some issues during cleanup')
     3936        return self.runStep()
     3937
     3938
    38923939class TestFindModifiedChangeLogs(BuildStepMixinAdditions, unittest.TestCase):
    38933940    def setUp(self):
  • trunk/Tools/ChangeLog

    r275814 r275853  
     12021-04-12  Aakash Jain  <aakash_jain@apple.com>
     2
     3        Make Commit Queue robust by adding few git commands to clean up repository
     4        https://bugs.webkit.org/show_bug.cgi?id=224444
     5
     6        Reviewed by Jonathan Bedard.
     7
     8        * CISupport/ews-build/steps.py:
     9        (CleanGitRepo): Build step to run few commands to cleanup git repository.
     10        (CleanGitRepo.run):
     11        (CleanGitRepo.getResultSummary): Custom failure message.
     12        * CISupport/ews-build/steps_unittest.py: Added unit-tests.
     13        * CISupport/ews-build/factories.py:
     14        (CommitQueueFactory.__init__):
     15        * CISupport/ews-build/factories_unittest.py:
     16        (TestCommitQueueFactory.test_commit_queue_factory): Updated unit-test.
     17
    1182021-04-11  Commit Queue  <commit-queue@webkit.org>
    219
Note: See TracChangeset for help on using the changeset viewer.