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