Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ews-build.webkit.org] Aggressively prune when cleaning #7275

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions Tools/CISupport/ews-build/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4662,6 +4662,17 @@ def __init__(self, default_branch=DEFAULT_BRANCH, remote=DEFAULT_REMOTE, **kwarg

def run(self):
self.commands = []
if self.getProperty('platform', '*') == 'wincairo':
self.commands.append(util.ShellArg(
command=self.shell_command(r'del .git\gc.log || {}'.format(self.shell_exit_0())),
logname='stdio',
))
else:
self.commands.append(util.ShellArg(
command=self.shell_command('rm -f .git/gc.log || {}'.format(self.shell_exit_0())),
logname='stdio',
))

for command in [
self.shell_command('git rebase --abort || {}'.format(self.shell_exit_0())),
self.shell_command('git am --abort || {}'.format(self.shell_exit_0())),
Expand All @@ -4672,6 +4683,7 @@ def run(self):
['git', 'checkout', '-b', '{}'.format(self.default_branch)], # Checkout local instance of branch from remote
self.shell_command('git branch | grep -v {} | xargs git branch -D || {}'.format(self.default_branch, self.shell_exit_0())),
self.shell_command('git remote | grep -v {} | xargs -L 1 git remote rm || {}'.format(self.git_remote, self.shell_exit_0())),
['git', 'prune'],
]:
self.commands.append(util.ShellArg(command=command, logname='stdio'))
return super(CleanGitRepo, self).run()
Expand Down
20 changes: 20 additions & 0 deletions Tools/CISupport/ews-build/steps_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5001,6 +5001,8 @@ def test_success(self):
self.setProperty('buildername', 'Style-EWS')

self.expectRemoteCommands(
ExpectShell(command=['/bin/sh', '-c', 'rm -f .git/gc.log || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['/bin/sh', '-c', 'git rebase --abort || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['/bin/sh', '-c', 'git am --abort || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
Expand All @@ -5019,6 +5021,8 @@ def test_success(self):
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['/bin/sh', '-c', 'git remote | grep -v origin | xargs -L 1 git remote rm || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['git', 'prune'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
)
self.expectOutcome(result=SUCCESS, state_string='Cleaned up git repository')
return self.runStep()
Expand All @@ -5029,6 +5033,8 @@ def test_success_wincairo(self):
self.setProperty('platform', 'wincairo')

self.expectRemoteCommands(
ExpectShell(command=['sh', '-c', r'del .git\gc.log || exit 0'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['sh', '-c', 'git rebase --abort || exit 0'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['sh', '-c', 'git am --abort || exit 0'], workdir='wkdir', timeout=300, logEnviron=False) + 0
Expand All @@ -5047,6 +5053,8 @@ def test_success_wincairo(self):
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['sh', '-c', 'git remote | grep -v origin | xargs -L 1 git remote rm || exit 0'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['git', 'prune'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
)
self.expectOutcome(result=SUCCESS, state_string='Cleaned up git repository')
return self.runStep()
Expand All @@ -5056,6 +5064,8 @@ def test_success_master(self):
self.setProperty('buildername', 'Commit-Queue')

self.expectRemoteCommands(
ExpectShell(command=['/bin/sh', '-c', 'rm -f .git/gc.log || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['/bin/sh', '-c', 'git rebase --abort || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['/bin/sh', '-c', 'git am --abort || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
Expand All @@ -5074,6 +5084,8 @@ def test_success_master(self):
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['/bin/sh', '-c', 'git remote | grep -v origin | xargs -L 1 git remote rm || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['git', 'prune'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
)
self.expectOutcome(result=SUCCESS, state_string='Cleaned up git repository')
return self.runStep()
Expand All @@ -5083,6 +5095,8 @@ def test_failure(self):
self.setProperty('buildername', 'Commit-Queue')

self.expectRemoteCommands(
ExpectShell(command=['/bin/sh', '-c', 'rm -f .git/gc.log || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['/bin/sh', '-c', 'git rebase --abort || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['/bin/sh', '-c', 'git am --abort || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
Expand All @@ -5101,6 +5115,8 @@ def test_failure(self):
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['/bin/sh', '-c', 'git remote | grep -v origin | xargs -L 1 git remote rm || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['git', 'prune'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
)
self.expectOutcome(result=FAILURE, state_string='Encountered some issues during cleanup')
return self.runStep()
Expand All @@ -5111,6 +5127,8 @@ def test_branch(self):
self.setProperty('basename', 'safari-612-branch')

self.expectRemoteCommands(
ExpectShell(command=['/bin/sh', '-c', 'rm -f .git/gc.log || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['/bin/sh', '-c', 'git rebase --abort || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['/bin/sh', '-c', 'git am --abort || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
Expand All @@ -5129,6 +5147,8 @@ def test_branch(self):
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['/bin/sh', '-c', 'git remote | grep -v origin | xargs -L 1 git remote rm || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['git', 'prune'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
)
self.expectOutcome(result=SUCCESS, state_string='Cleaned up git repository')
return self.runStep()
Expand Down