⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287857 in webkit


Ignore:
Timestamp:
Jan 10, 2022, 2:18:11 PM (5 years ago)
Author:
Jonathan Bedard
Message:

[EWS] Always invoke CleanGitRepo before CheckOutSource
https://bugs.webkit.org/show_bug.cgi?id=234882
<rdar://problem/87145396>

Reviewed by Aakash Jain.

  • Tools/CISupport/ews-build/factories.py:

(Factory.init): Add CleanGitRepo step.
(StyleFactory.init): Ditto.
(WatchListFactory.init): Ditto.
(CommitQueueFactory.init): Specify default branch as 'master.'

  • Tools/CISupport/ews-build/factories_unittest.py:

(TestExpectedBuildSteps):

  • Tools/CISupport/ews-build/steps.py:

(CleanGitRepo.init): Accept default_branch and remote.
(CleanGitRepo.run): Construct commands with awareness of branch and remote,
check to see if a basename is specified.

  • Tools/CISupport/ews-build/steps_unittest.py:

Canonical link: https://commits.webkit.org/245902@main

Location:
trunk/Tools
Files:
5 edited

Legend:

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

    r286405 r287857  
    4949        self.addStep(ValidatePatch())
    5050        self.addStep(PrintConfiguration())
     51        self.addStep(CleanGitRepo())
    5152        self.addStep(CheckOutSource())
    5253        # CheckOutSource step pulls the latest revision, since we use alwaysUseLatest=True. Without alwaysUseLatest Buildbot will
     
    6566        self.addStep(ValidatePatch())
    6667        self.addStep(PrintConfiguration())
     68        self.addStep(CleanGitRepo())
    6769        self.addStep(CheckOutSource())
    6870        self.addStep(FetchBranches())
     
    7981        self.addStep(ValidatePatch())
    8082        self.addStep(PrintConfiguration())
     83        self.addStep(CleanGitRepo())
    8184        self.addStep(CheckOutSource())
    8285        self.addStep(FetchBranches())
     
    286289        self.addStep(ValidateCommiterAndReviewer())
    287290        self.addStep(PrintConfiguration())
    288         self.addStep(CleanGitRepo())
     291        self.addStep(CleanGitRepo(default_branch='master'))
    289292        self.addStep(CheckOutSource(repourl='https://git.webkit.org/git/WebKit-https'))
    290293        self.addStep(FetchBranches())
  • trunk/Tools/CISupport/ews-build/factories_unittest.py

    r284492 r287857  
    3434            'validate-patch',
    3535            'configuration',
     36            'clean-up-git-repo',
    3637            'clean-and-update-working-directory',
    3738            'fetch-branch-references',
     
    4546            'validate-patch',
    4647            'configuration',
     48            'clean-up-git-repo',
    4749            'clean-and-update-working-directory',
    4850            'fetch-branch-references',
     
    5658            'validate-patch',
    5759            'configuration',
     60            'clean-up-git-repo',
    5861            'clean-and-update-working-directory',
    5962            'checkout-specific-revision',
     
    7073            'validate-patch',
    7174            'configuration',
     75            'clean-up-git-repo',
    7276            'clean-and-update-working-directory',
    7377            'checkout-specific-revision',
     
    8892            'validate-patch',
    8993            'configuration',
     94            'clean-up-git-repo',
    9095            'clean-and-update-working-directory',
    9196            'checkout-specific-revision',
     
    100105            'validate-patch',
    101106            'configuration',
     107            'clean-up-git-repo',
    102108            'clean-and-update-working-directory',
    103109            'checkout-specific-revision',
     
    112118            'validate-patch',
    113119            'configuration',
     120            'clean-up-git-repo',
    114121            'clean-and-update-working-directory',
    115122            'checkout-specific-revision',
     
    132139            'validate-patch',
    133140            'configuration',
     141            'clean-up-git-repo',
    134142            'clean-and-update-working-directory',
    135143            'checkout-specific-revision',
     
    144152            'validate-patch',
    145153            'configuration',
     154            'clean-up-git-repo',
    146155            'clean-and-update-working-directory',
    147156            'checkout-specific-revision',
     
    163172            'validate-patch',
    164173            'configuration',
     174            'clean-up-git-repo',
    165175            'clean-and-update-working-directory',
    166176            'checkout-specific-revision',
     
    176186            'validate-patch',
    177187            'configuration',
     188            'clean-up-git-repo',
    178189            'clean-and-update-working-directory',
    179190            'checkout-specific-revision',
     
    195206            'validate-patch',
    196207            'configuration',
     208            'clean-up-git-repo',
    197209            'clean-and-update-working-directory',
    198210            'checkout-specific-revision',
     
    215227            'validate-patch',
    216228            'configuration',
     229            'clean-up-git-repo',
    217230            'clean-and-update-working-directory',
    218231            'checkout-specific-revision',
     
    232245            'validate-patch',
    233246            'configuration',
     247            'clean-up-git-repo',
    234248            'clean-and-update-working-directory',
    235249            'checkout-specific-revision',
     
    245259            'validate-patch',
    246260            'configuration',
     261            'clean-up-git-repo',
    247262            'clean-and-update-working-directory',
    248263            'checkout-specific-revision',
     
    264279            'validate-patch',
    265280            'configuration',
     281            'clean-up-git-repo',
    266282            'clean-and-update-working-directory',
    267283            'checkout-specific-revision',
     
    276292            'validate-patch',
    277293            'configuration',
     294            'clean-up-git-repo',
    278295            'clean-and-update-working-directory',
    279296            'checkout-specific-revision',
     
    288305            'validate-patch',
    289306            'configuration',
     307            'clean-up-git-repo',
    290308            'clean-and-update-working-directory',
    291309            'checkout-specific-revision',
     
    300318            'validate-patch',
    301319            'configuration',
     320            'clean-up-git-repo',
    302321            'clean-and-update-working-directory',
    303322            'checkout-specific-revision',
     
    313332            'validate-patch',
    314333            'configuration',
     334            'clean-up-git-repo',
    315335            'clean-and-update-working-directory',
    316336            'checkout-specific-revision',
     
    328348            'validate-patch',
    329349            'configuration',
     350            'clean-up-git-repo',
    330351            'clean-and-update-working-directory',
    331352            'checkout-specific-revision',
     
    340361            'validate-patch',
    341362            'configuration',
     363            'clean-up-git-repo',
    342364            'clean-and-update-working-directory',
    343365            'checkout-specific-revision',
     
    354376            'validate-patch',
    355377            'configuration',
     378            'clean-up-git-repo',
    356379            'clean-and-update-working-directory',
    357380            'checkout-specific-revision',
     
    368391            'validate-patch',
    369392            'configuration',
     393            'clean-up-git-repo',
    370394            'clean-and-update-working-directory',
    371395            'checkout-specific-revision',
     
    381405            'validate-patch',
    382406            'configuration',
     407            'clean-up-git-repo',
    383408            'clean-and-update-working-directory',
    384409            'checkout-specific-revision',
     
    396421            'validate-patch',
    397422            'configuration',
     423            'clean-up-git-repo',
    398424            'clean-and-update-working-directory',
    399425            'checkout-specific-revision',
     
    409435            'validate-patch',
    410436            'configuration',
     437            'clean-up-git-repo',
    411438            'clean-and-update-working-directory',
    412439            'checkout-specific-revision',
     
    424451            'validate-patch',
    425452            'configuration',
     453            'clean-up-git-repo',
    426454            'clean-and-update-working-directory',
    427455            'checkout-specific-revision',
     
    437465            'validate-patch',
    438466            'configuration',
     467            'clean-up-git-repo',
    439468            'clean-and-update-working-directory',
    440469            'checkout-specific-revision',
     
    449478            'validate-patch',
    450479            'configuration',
     480            'clean-up-git-repo',
    451481            'clean-and-update-working-directory',
    452482            'checkout-specific-revision',
     
    462492            'validate-patch',
    463493            'configuration',
     494            'clean-up-git-repo',
    464495            'clean-and-update-working-directory',
    465496            'checkout-specific-revision',
     
    473504            'validate-patch',
    474505            'configuration',
     506            'clean-up-git-repo',
    475507            'clean-and-update-working-directory',
    476508            'checkout-specific-revision',
     
    487519            'validate-patch',
    488520            'configuration',
     521            'clean-up-git-repo',
    489522            'clean-and-update-working-directory',
    490523            'checkout-specific-revision',
     
    501534            'validate-patch',
    502535            'configuration',
     536            'clean-up-git-repo',
    503537            'clean-and-update-working-directory',
    504538            'checkout-specific-revision',
     
    517551            'validate-patch',
    518552            'configuration',
     553            'clean-up-git-repo',
    519554            'clean-and-update-working-directory',
    520555            'checkout-specific-revision',
  • trunk/Tools/CISupport/ews-build/steps.py

    r287719 r287857  
    35753575    flunkOnFailure = False
    35763576    logEnviron = False
    3577     # This somewhat quirky sequence of steps seems to clear up all the broken
    3578     # git situations we've gotten ourself into in the past.
    3579     command_list = [['git', 'clean', '-f', '-d'],  # Remove any left-over layout test results, added files, etc.
    3580                     ['git', 'fetch', 'origin'],  # Avoid updating the working copy to a stale revision.
    3581                     ['git', 'checkout', 'origin/master', '-f'],
    3582                     ['git', 'branch', '-D', 'master'],
    3583                     ['git', 'checkout', 'origin/master', '-b', 'master']]
     3577
     3578    def __init__(self, default_branch='main', remote='origin', **kwargs):
     3579        super(CleanGitRepo, self).__init__(timeout=5 * 60, **kwargs)
     3580        self.default_branch = default_branch
     3581        self.git_remote = remote
    35843582
    35853583    def run(self):
     3584        branch = self.getProperty('basename', self.default_branch)
    35863585        self.commands = []
    3587         for command in self.command_list:
     3586        for command in [
     3587            ['git', 'clean', '-f', '-d'],  # Remove any left-over layout test results, added files, etc.
     3588            ['git', 'fetch', self.git_remote],  # Avoid updating the working copy to a stale revision.
     3589            ['git', 'checkout', '{}/{}'.format(self.git_remote, branch), '-f'],  # Checkout branch from specific remote
     3590            ['git', 'branch', '-D', '{}'.format(branch)],  # Delete any local cache of the specified branch
     3591            ['git', 'checkout', '{}/{}'.format(self.git_remote, branch), '-b', '{}'.format(branch)],  # Checkout local instance of branch from remote
     3592        ]:
    35883593            self.commands.append(util.ShellArg(command=command, logname='stdio'))
    35893594        return super(CleanGitRepo, self).run()
  • trunk/Tools/CISupport/ews-build/steps_unittest.py

    r287133 r287857  
    43314331    def test_success(self):
    43324332        self.setupStep(CleanGitRepo())
     4333        self.setProperty('buildername', 'Style-EWS')
     4334
     4335        self.expectRemoteCommands(
     4336            ExpectShell(command=['git', 'clean', '-f', '-d'], workdir='wkdir', timeout=300, logEnviron=False) + 0
     4337            + ExpectShell.log('stdio', stdout=''),
     4338            ExpectShell(command=['git', 'fetch', 'origin'], workdir='wkdir', timeout=300, logEnviron=False) + 0
     4339            + ExpectShell.log('stdio', stdout=''),
     4340            ExpectShell(command=['git', 'checkout', 'origin/main', '-f'], workdir='wkdir', timeout=300, logEnviron=False) + 0
     4341            + ExpectShell.log('stdio', stdout='You are in detached HEAD state.'),
     4342            ExpectShell(command=['git', 'branch', '-D', 'main'], workdir='wkdir', timeout=300, logEnviron=False) + 0
     4343            + ExpectShell.log('stdio', stdout='Deleted branch main (was 57015967fef9).'),
     4344            ExpectShell(command=['git', 'checkout', 'origin/main', '-b', 'main'], workdir='wkdir', timeout=300, logEnviron=False) + 0
     4345            + ExpectShell.log('stdio', stdout="Switched to a new branch 'main'"),
     4346        )
     4347        self.expectOutcome(result=SUCCESS, state_string='Cleaned up git repository')
     4348        return self.runStep()
     4349
     4350    def test_success_master(self):
     4351        self.setupStep(CleanGitRepo(default_branch='master'))
    43334352        self.setProperty('buildername', 'Commit-Queue')
    43344353
    43354354        self.expectRemoteCommands(
    4336             ExpectShell(command=['git', 'clean', '-f', '-d'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     4355            ExpectShell(command=['git', 'clean', '-f', '-d'], workdir='wkdir', timeout=300, logEnviron=False) + 0
    43374356            + ExpectShell.log('stdio', stdout=''),
    4338             ExpectShell(command=['git', 'fetch', 'origin'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     4357            ExpectShell(command=['git', 'fetch', 'origin'], workdir='wkdir', timeout=300, logEnviron=False) + 0
    43394358            + ExpectShell.log('stdio', stdout=''),
    4340             ExpectShell(command=['git', 'checkout', 'origin/master', '-f'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     4359            ExpectShell(command=['git', 'checkout', 'origin/master', '-f'], workdir='wkdir', timeout=300, logEnviron=False) + 0
    43414360            + ExpectShell.log('stdio', stdout='You are in detached HEAD state.'),
    4342             ExpectShell(command=['git', 'branch', '-D', 'master'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     4361            ExpectShell(command=['git', 'branch', '-D', 'master'], workdir='wkdir', timeout=300, logEnviron=False) + 0
    43434362            + ExpectShell.log('stdio', stdout='Deleted branch master (was 57015967fef9).'),
    4344             ExpectShell(command=['git', 'checkout', 'origin/master', '-b', 'master'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     4363            ExpectShell(command=['git', 'checkout', 'origin/master', '-b', 'master'], workdir='wkdir', timeout=300, logEnviron=False) + 0
    43454364            + ExpectShell.log('stdio', stdout="Switched to a new branch 'master'"),
    43464365        )
     
    43534372
    43544373        self.expectRemoteCommands(
    4355             ExpectShell(command=['git', 'clean', '-f', '-d'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     4374            ExpectShell(command=['git', 'clean', '-f', '-d'], workdir='wkdir', timeout=300, logEnviron=False) + 0
    43564375            + ExpectShell.log('stdio', stdout=''),
    4357             ExpectShell(command=['git', 'fetch', 'origin'], workdir='wkdir', timeout=1200, logEnviron=False) + 128
     4376            ExpectShell(command=['git', 'fetch', 'origin'], workdir='wkdir', timeout=300, logEnviron=False) + 128
    43584377            + ExpectShell.log('stdio', stdout='fatal: unable to access https://github.com/WebKit/WebKit.git/: Could not resolve host: github.com'),
    4359             ExpectShell(command=['git', 'checkout', 'origin/master', '-f'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
     4378            ExpectShell(command=['git', 'checkout', 'origin/main', '-f'], workdir='wkdir', timeout=300, logEnviron=False) + 0
    43604379            + ExpectShell.log('stdio', stdout='You are in detached HEAD state.'),
    4361             ExpectShell(command=['git', 'branch', '-D', 'master'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
    4362             + ExpectShell.log('stdio', stdout='Deleted branch master (was 57015967fef9).'),
    4363             ExpectShell(command=['git', 'checkout', 'origin/master', '-b', 'master'], workdir='wkdir', timeout=1200, logEnviron=False) + 0
    4364             + ExpectShell.log('stdio', stdout="Switched to a new branch 'master'"),
     4380            ExpectShell(command=['git', 'branch', '-D', 'main'], workdir='wkdir', timeout=300, logEnviron=False) + 0
     4381            + ExpectShell.log('stdio', stdout='Deleted branch main (was 57015967fef9).'),
     4382            ExpectShell(command=['git', 'checkout', 'origin/main', '-b', 'main'], workdir='wkdir', timeout=300, logEnviron=False) + 0
     4383            + ExpectShell.log('stdio', stdout="Switched to a new branch 'main'"),
    43654384        )
    43664385        self.expectOutcome(result=FAILURE, state_string='Encountered some issues during cleanup')
    43674386        return self.runStep()
    43684387
     4388    def test_branch(self):
     4389        self.setupStep(CleanGitRepo())
     4390        self.setProperty('buildername', 'Commit-Queue')
     4391        self.setProperty('basename', 'safari-612-branch')
     4392
     4393        self.expectRemoteCommands(
     4394            ExpectShell(command=['git', 'clean', '-f', '-d'], workdir='wkdir', timeout=300, logEnviron=False) + 0
     4395            + ExpectShell.log('stdio', stdout=''),
     4396            ExpectShell(command=['git', 'fetch', 'origin'], workdir='wkdir', timeout=300, logEnviron=False) + 0
     4397            + ExpectShell.log('stdio', stdout=''),
     4398            ExpectShell(command=['git', 'checkout', 'origin/safari-612-branch', '-f'], workdir='wkdir', timeout=300, logEnviron=False) + 0
     4399            + ExpectShell.log('stdio', stdout='You are in detached HEAD state.'),
     4400            ExpectShell(command=['git', 'branch', '-D', 'safari-612-branch'], workdir='wkdir', timeout=300, logEnviron=False) + 0
     4401            + ExpectShell.log('stdio', stdout='Deleted branch safari-612-branch (was 57015967fef9).'),
     4402            ExpectShell(command=['git', 'checkout', 'origin/safari-612-branch', '-b', 'safari-612-branch'], workdir='wkdir', timeout=300, logEnviron=False) + 0
     4403            + ExpectShell.log('stdio', stdout="Switched to a new branch 'safari-612-branch'"),
     4404        )
     4405        self.expectOutcome(result=SUCCESS, state_string='Cleaned up git repository')
     4406        return self.runStep()
    43694407
    43704408class TestFindModifiedChangeLogs(BuildStepMixinAdditions, unittest.TestCase):
  • trunk/Tools/ChangeLog

    r287853 r287857  
     12022-01-05  Jonathan Bedard  <jbedard@apple.com>
     2
     3        [EWS] Always invoke CleanGitRepo before CheckOutSource
     4        https://bugs.webkit.org/show_bug.cgi?id=234882
     5        <rdar://problem/87145396>
     6
     7        Reviewed by Aakash Jain.
     8
     9        * CISupport/ews-build/factories.py:
     10        (Factory.__init__): Add CleanGitRepo step.
     11        (StyleFactory.__init__): Ditto.
     12        (WatchListFactory.__init__): Ditto.
     13        (CommitQueueFactory.__init__): Specify default branch as 'master.'
     14        * CISupport/ews-build/factories_unittest.py:
     15        (TestExpectedBuildSteps):
     16        * CISupport/ews-build/steps.py:
     17        (CleanGitRepo.__init__): Accept default_branch and remote.
     18        (CleanGitRepo.run): Construct commands with awareness of branch and remote,
     19        check to see if a basename is specified.
     20        * CISupport/ews-build/steps_unittest.py:
     21
    1222021-12-17  Jonathan Bedard  <jbedard@apple.com>
    223
Note: See TracChangeset for help on using the changeset viewer.