Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Side by Side Diff: scripts/slave/recipe_modules/goma/resources/ensure_goma.py

Issue 1835943004: ensure_goma: use git retry for clone and fetch (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import argparse 6 import argparse
7 import datetime 7 import datetime
8 import os 8 import os
9 import shutil 9 import shutil
10 import subprocess 10 import subprocess
(...skipping 30 matching lines...) Expand all
41 client_dir = args.target_dir 41 client_dir = args.target_dir
42 if not os.path.exists(client_dir): 42 if not os.path.exists(client_dir):
43 os.makedirs(client_dir) 43 os.makedirs(client_dir)
44 44
45 current_repo = subprocess.check_output( 45 current_repo = subprocess.check_output(
46 ['git', 'ls-remote', '--get-url'], cwd=client_dir).strip() 46 ['git', 'ls-remote', '--get-url'], cwd=client_dir).strip()
47 if current_repo != config['repo']: 47 if current_repo != config['repo']:
48 print '[%s]: repo mismatch. initial clone' % ( 48 print '[%s]: repo mismatch. initial clone' % (
49 datetime.datetime.utcnow() - start) 49 datetime.datetime.utcnow() - start)
50 shutil.rmtree(client_dir) 50 shutil.rmtree(client_dir)
51 subprocess.check_call(['git', 'clone', config['repo'], client_dir]) 51 subprocess.check_call(['git', 'retry', 'clone', config['repo'], client_dir])
52 52
53 print '[%s]: fetch' % (datetime.datetime.utcnow() - start) 53 print '[%s]: fetch' % (datetime.datetime.utcnow() - start)
54 subprocess.check_call(['git', 'fetch'], cwd=client_dir) 54 subprocess.check_call(['git', 'retry', 'fetch'], cwd=client_dir)
55 rev = config['revision'] 55 rev = config['revision']
56 if args.canary: 56 if args.canary:
57 rev = 'refs/remotes/origin/HEAD' 57 rev = 'refs/remotes/origin/HEAD'
58 print '[%s]: reset %s' % (datetime.datetime.utcnow() - start, rev) 58 print '[%s]: reset %s' % (datetime.datetime.utcnow() - start, rev)
59 subprocess.check_call( 59 subprocess.check_call(
60 ['git', 'reset', '--hard', rev], cwd=client_dir) 60 ['git', 'reset', '--hard', rev], cwd=client_dir)
61 61
62 print '[%s]: download binaries' % (datetime.datetime.utcnow() - start) 62 print '[%s]: download binaries' % (datetime.datetime.utcnow() - start)
63 subprocess.check_call([sys.executable, 63 subprocess.check_call([sys.executable,
64 args.download_from_google_storage_path, 64 args.download_from_google_storage_path,
65 '--directory', 65 '--directory',
66 '--recursive', 66 '--recursive',
67 '--bucket', 'chrome-goma', 67 '--bucket', 'chrome-goma',
68 client_dir]) 68 client_dir])
69 69
70 subprocess.check_call( 70 subprocess.check_call(
71 [sys.executable, os.path.join(client_dir, 'fix_file_modes.py')]) 71 [sys.executable, os.path.join(client_dir, 'fix_file_modes.py')])
72 72
73 print '[%s]: done' % (datetime.datetime.utcnow() - start) 73 print '[%s]: done' % (datetime.datetime.utcnow() - start)
74 return 0 74 return 0
75 75
76 76
77 if __name__ == '__main__': 77 if __name__ == '__main__':
78 sys.exit(main(sys.argv[1:])) 78 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698