OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 DEPS = [ | 5 DEPS = [ |
6 'depot_tools/bot_update', | 6 'depot_tools/bot_update', |
| 7 'depot_tools/infra_paths', |
7 'file', | 8 'file', |
8 'depot_tools/gclient', | 9 'depot_tools/gclient', |
9 'depot_tools/git', | 10 'depot_tools/git', |
10 'gsutil', | 11 'gsutil', |
11 'recipe_engine/json', | 12 'recipe_engine/json', |
12 'recipe_engine/path', | 13 'recipe_engine/path', |
13 'recipe_engine/properties', | 14 'recipe_engine/properties', |
14 'recipe_engine/python', | 15 'recipe_engine/python', |
15 'recipe_engine/raw_io', | 16 'recipe_engine/raw_io', |
16 'recipe_engine/step', | 17 'recipe_engine/step', |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 'update-ref', ref, hsh, | 54 'update-ref', ref, hsh, |
54 cwd=api.path['checkout'], | 55 cwd=api.path['checkout'], |
55 ) | 56 ) |
56 api.git( | 57 api.git( |
57 'push', repo, '%s:%s' % (ref, ref), | 58 'push', repo, '%s:%s' % (ref, ref), |
58 cwd=api.path['checkout'], | 59 cwd=api.path['checkout'], |
59 ) | 60 ) |
60 | 61 |
61 # Upload log for debugging. | 62 # Upload log for debugging. |
62 ref_log_file_name = ref.replace('/', '_') + '.log' | 63 ref_log_file_name = ref.replace('/', '_') + '.log' |
63 ref_log_path = api.path['slave_build'].join(ref_log_file_name) | 64 ref_log_path = api.infra_paths['slave_build'].join(ref_log_file_name) |
64 log = [] | 65 log = [] |
65 if api.path.exists(ref_log_path): | 66 if api.path.exists(ref_log_path): |
66 log.append(api.file.read( | 67 log.append(api.file.read( |
67 'Read %s' % ref_log_file_name, ref_log_path, test_data='')) | 68 'Read %s' % ref_log_file_name, ref_log_path, test_data='')) |
68 log.append('%s %s' % (hsh, str(api.time.time()))) | 69 log.append('%s %s' % (hsh, str(api.time.time()))) |
69 api.file.write('Write %s' % ref_log_file_name, ref_log_path, '\n'.join(log)) | 70 api.file.write('Write %s' % ref_log_file_name, ref_log_path, '\n'.join(log)) |
70 api.gsutil.upload( | 71 api.gsutil.upload( |
71 ref_log_path, | 72 ref_log_path, |
72 'chromium-v8-auto-roll', | 73 'chromium-v8-auto-roll', |
73 api.path.join('v8_release_process', ref_log_file_name), | 74 api.path.join('v8_release_process', ref_log_file_name), |
74 ) | 75 ) |
75 | 76 |
76 | 77 |
77 def ReadTimeStamp(api, name): | 78 def ReadTimeStamp(api, name): |
78 return int(float( | 79 return int(float( |
79 api.file.read( | 80 api.file.read( |
80 name, | 81 name, |
81 api.path['slave_build'].join('timestamp.txt'), | 82 api.infra_paths['slave_build'].join('timestamp.txt'), |
82 ).strip())) | 83 ).strip())) |
83 | 84 |
84 | 85 |
85 def WriteTimeStamp(api, name, timestamp): | 86 def WriteTimeStamp(api, name, timestamp): |
86 api.file.write( | 87 api.file.write( |
87 name, | 88 name, |
88 api.path['slave_build'].join('timestamp.txt'), | 89 api.infra_paths['slave_build'].join('timestamp.txt'), |
89 str(timestamp), | 90 str(timestamp), |
90 ) | 91 ) |
91 | 92 |
92 | 93 |
93 def LogStep(api, text): | 94 def LogStep(api, text): |
94 api.step('log', ['echo', text]) | 95 api.step('log', ['echo', text]) |
95 | 96 |
96 | 97 |
97 def AgeLimitBailout(api, new_date, old_date): | 98 def AgeLimitBailout(api, new_date, old_date): |
98 age = (new_date - old_date) / SEC_TO_HOURS | 99 age = (new_date - old_date) / SEC_TO_HOURS |
99 LogStep(api, 'Current candidate is %dh old (limit: %dh).' % | 100 LogStep(api, 'Current candidate is %dh old (limit: %dh).' % |
100 (age, TIME_LIMIT_HOURS)) | 101 (age, TIME_LIMIT_HOURS)) |
101 return age < TIME_LIMIT_HOURS | 102 return age < TIME_LIMIT_HOURS |
102 | 103 |
103 | 104 |
104 def GetLKGR(api): | 105 def GetLKGR(api): |
105 step_result = api.python( | 106 step_result = api.python( |
106 'get new lkgr', | 107 'get new lkgr', |
107 api.path['build'].join('scripts', 'tools', 'runit.py'), | 108 api.infra_paths['build'].join('scripts', 'tools', 'runit.py'), |
108 [api.path['build'].join('scripts', 'tools', 'pycurl.py'), | 109 [api.infra_paths['build'].join('scripts', 'tools', 'pycurl.py'), |
109 '%s/lkgr' % STATUS_URL], | 110 '%s/lkgr' % STATUS_URL], |
110 stdout=api.raw_io.output(), | 111 stdout=api.raw_io.output(), |
111 ) | 112 ) |
112 lkgr = step_result.stdout.strip() | 113 lkgr = step_result.stdout.strip() |
113 step_result.presentation.logs['logs'] = [ | 114 step_result.presentation.logs['logs'] = [ |
114 'New candidate: %s (%s)' % (lkgr, str(api.time.time())), | 115 'New candidate: %s (%s)' % (lkgr, str(api.time.time())), |
115 ] | 116 ] |
116 return lkgr | 117 return lkgr |
117 | 118 |
118 | 119 |
119 def ClusterfuzzHasIssues(api): | 120 def ClusterfuzzHasIssues(api): |
120 step_test_data = lambda: api.json.test_api.output([]) | 121 step_test_data = lambda: api.json.test_api.output([]) |
121 step_result = api.python( | 122 step_result = api.python( |
122 'check clusterfuzz', | 123 'check clusterfuzz', |
123 api.path['checkout'].join( | 124 api.path['checkout'].join( |
124 'tools', 'release', 'check_clusterfuzz.py'), | 125 'tools', 'release', 'check_clusterfuzz.py'), |
125 ['--key-file', api.path['slave_build'].join('.cf_key'), | 126 ['--key-file', api.infra_paths['slave_build'].join('.cf_key'), |
126 '--results-file', api.json.output(add_json_log=False)], | 127 '--results-file', api.json.output(add_json_log=False)], |
127 # Note: Output is suppressed for security reasons. | 128 # Note: Output is suppressed for security reasons. |
128 stdout=api.raw_io.output('out'), | 129 stdout=api.raw_io.output('out'), |
129 stderr=api.raw_io.output('err'), | 130 stderr=api.raw_io.output('err'), |
130 step_test_data=step_test_data, | 131 step_test_data=step_test_data, |
131 ) | 132 ) |
132 results = step_result.json.output | 133 results = step_result.json.output |
133 if results: | 134 if results: |
134 step_result.presentation.text = 'Found %s issues.' % len(results) | 135 step_result.presentation.text = 'Found %s issues.' % len(results) |
135 for result in results[:SHOW_MAX_ISSUES]: | 136 for result in results[:SHOW_MAX_ISSUES]: |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 api.override_step_data( | 221 api.override_step_data( |
221 'git show-ref %s' % ROLL_REF, | 222 'git show-ref %s' % ROLL_REF, |
222 api.raw_io.stream_output(current_roll, stream='stdout'), | 223 api.raw_io.stream_output(current_roll, stream='stdout'), |
223 ) + | 224 ) + |
224 api.override_step_data( | 225 api.override_step_data( |
225 'check timestamp', | 226 'check timestamp', |
226 api.raw_io.output(current_date), | 227 api.raw_io.output(current_date), |
227 ) + | 228 ) + |
228 api.time.seed(int(float(new_date))) + | 229 api.time.seed(int(float(new_date))) + |
229 api.time.step(2) + | 230 api.time.step(2) + |
230 api.path.exists(api.path['slave_build'].join( | 231 api.infra_paths.exists(api.infra_paths['slave_build'].join( |
231 LKGR_REF.replace('/', '_') + '.log')) | 232 LKGR_REF.replace('/', '_') + '.log')) |
232 ) | 233 ) |
233 | 234 |
234 yield Test( | 235 yield Test( |
235 'same_lkgr', | 236 'same_lkgr', |
236 hsh_old, | 237 hsh_old, |
237 date_old, | 238 date_old, |
238 hsh_old, | 239 hsh_old, |
239 date_new, | 240 date_new, |
240 ) | 241 ) |
(...skipping 27 matching lines...) Expand all Loading... |
268 date_new, | 269 date_new, |
269 current_roll=hsh_old, | 270 current_roll=hsh_old, |
270 ) + api.override_step_data('check clusterfuzz', api.json.output([1, 2])) | 271 ) + api.override_step_data('check clusterfuzz', api.json.output([1, 2])) |
271 yield Test( | 272 yield Test( |
272 'new_lkgr_failed_timestamp', | 273 'new_lkgr_failed_timestamp', |
273 hsh_recent, | 274 hsh_recent, |
274 date_recent, | 275 date_recent, |
275 hsh_new, | 276 hsh_new, |
276 date_new, | 277 date_new, |
277 ) + api.override_step_data('check timestamp', retcode=1) | 278 ) + api.override_step_data('check timestamp', retcode=1) |
OLD | NEW |