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

Side by Side Diff: tools/gn/bin/roll_gn.py

Issue 1336713002: Fix GN auto-roller to handle results from buildbucket-initiated jobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 # 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 """An auto-roller for GN binaries into Chromium. 5 """An auto-roller for GN binaries into Chromium.
6 6
7 This script is used to update the GN binaries that a Chromium 7 This script is used to update the GN binaries that a Chromium
8 checkout uses. In order to update the binaries, one must follow 8 checkout uses. In order to update the binaries, one must follow
9 four steps in order: 9 four steps in order:
10 10
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 raise 203 raise
204 204
205 patchset = int(props['patchsets'][-1]) 205 patchset = int(props['patchsets'][-1])
206 206
207 try: 207 try:
208 patchset_data = json.loads(rpc_server.Send('/api/%d/%d' % 208 patchset_data = json.loads(rpc_server.Send('/api/%d/%d' %
209 (issue, patchset))) 209 (issue, patchset)))
210 except Exception as _e: 210 except Exception as _e:
211 raise 211 raise
212 212
213 TRY_JOB_RESULT_STATES = ('success', 'warnings', 'failure', 'skipped',
214 'exception', 'retry', 'pending')
215 try_job_results = patchset_data['try_job_results'] 213 try_job_results = patchset_data['try_job_results']
216 if not try_job_results: 214 if not try_job_results:
217 print('No try jobs found on most recent patchset') 215 print('No try jobs found on most recent patchset')
218 return 1 216 return 1
219 217
220 results = {} 218 results = {}
221 for job in try_job_results: 219 for job in try_job_results:
222 builder = job['builder'] 220 builder = job['builder']
223 if builder == 'linux_chromium_gn_upload': 221 if builder == 'linux_chromium_gn_upload':
224 platform = 'linux64' 222 platform = 'linux64'
225 elif builder == 'mac_chromium_gn_upload': 223 elif builder == 'mac_chromium_gn_upload':
226 platform = 'mac' 224 platform = 'mac'
227 elif builder == 'win8_chromium_gn_upload': 225 elif builder == 'win8_chromium_gn_upload':
228 platform = 'win' 226 platform = 'win'
229 else: 227 else:
230 print('Unexpected builder: %s') 228 print('Unexpected builder: %s')
231 continue 229 continue
232 230
233 state = TRY_JOB_RESULT_STATES[int(job['result'])] 231 TRY_JOB_RESULT_STATES = ('started', 'success', 'warnings', 'failure',
232 'skipped', 'exception', 'retry', 'pending')
233 state = TRY_JOB_RESULT_STATES[int(job['result']) + 1]
234 url_str = ' %s' % job['url'] 234 url_str = ' %s' % job['url']
235 build = url_str.split('/')[-1] 235 build = url_str.split('/')[-1]
236 236
237 sha1 = '-' 237 sha1 = '-'
238 results.setdefault(platform, {'build': -1, 'sha1': '', 'url': url_str}) 238 results.setdefault(platform, {'build': -1, 'sha1': '', 'url': url_str})
239 239
240 if state == 'success': 240 if state == 'success':
241 jsurl = url_str.replace('/builders/', '/json/builders/') 241 jsurl = url_str.replace('/builders/', '/json/builders/')
242 fp = urllib2.urlopen(jsurl) 242 fp = urllib2.urlopen(jsurl)
243 js = json.loads(fp.read()) 243 js = json.loads(fp.read())
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 def Call(self, cmd, cwd=None): 405 def Call(self, cmd, cwd=None):
406 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, 406 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True,
407 cwd=(cwd or self.chromium_src_dir)) 407 cwd=(cwd or self.chromium_src_dir))
408 out, err = proc.communicate() 408 out, err = proc.communicate()
409 return proc.returncode, out, err 409 return proc.returncode, out, err
410 410
411 411
412 if __name__ == '__main__': 412 if __name__ == '__main__':
413 roller = GNRoller() 413 roller = GNRoller()
414 sys.exit(roller.Roll()) 414 sys.exit(roller.Roll())
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