| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
| 7 | 7 |
| 8 """A git-command for integrating reviews on Rietveld.""" | 8 """A git-command for integrating reviews on Rietveld.""" |
| 9 | 9 |
| 10 from distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 return master | 238 return master |
| 239 return '%s%s' % (prefix, master) | 239 return '%s%s' % (prefix, master) |
| 240 | 240 |
| 241 | 241 |
| 242 def trigger_luci_job(changelist, masters, options): | 242 def trigger_luci_job(changelist, masters, options): |
| 243 """Send a job to run on LUCI.""" | 243 """Send a job to run on LUCI.""" |
| 244 issue_props = changelist.GetIssueProperties() | 244 issue_props = changelist.GetIssueProperties() |
| 245 issue = changelist.GetIssue() | 245 issue = changelist.GetIssue() |
| 246 patchset = changelist.GetMostRecentPatchset() | 246 patchset = changelist.GetMostRecentPatchset() |
| 247 for builders_and_tests in sorted(masters.itervalues()): | 247 for builders_and_tests in sorted(masters.itervalues()): |
| 248 for builder in sorted(builders_and_tests.iterkeys()): | 248 # TODO(hinoka et al): add support for other properties. |
| 249 # Currently, this completely ignores testfilter and other properties. |
| 250 for builder in sorted(builders_and_tests): |
| 249 luci_trigger.trigger( | 251 luci_trigger.trigger( |
| 250 builder, 'HEAD', issue, patchset, issue_props['project']) | 252 builder, 'HEAD', issue, patchset, issue_props['project']) |
| 251 | 253 |
| 252 | 254 |
| 253 def trigger_try_jobs(auth_config, changelist, options, masters, category): | 255 def trigger_try_jobs(auth_config, changelist, options, masters, category): |
| 254 rietveld_url = settings.GetDefaultServerUrl() | 256 rietveld_url = settings.GetDefaultServerUrl() |
| 255 rietveld_host = urlparse.urlparse(rietveld_url).hostname | 257 rietveld_host = urlparse.urlparse(rietveld_url).hostname |
| 256 authenticator = auth.get_authenticator_for_host(rietveld_host, auth_config) | 258 authenticator = auth.get_authenticator_for_host(rietveld_host, auth_config) |
| 257 http = authenticator.authorize(httplib2.Http()) | 259 http = authenticator.authorize(httplib2.Http()) |
| 258 http.force_exception_to_status_code = True | 260 http.force_exception_to_status_code = True |
| (...skipping 26 matching lines...) Expand all Loading... |
| 285 }], | 287 }], |
| 286 'properties': { | 288 'properties': { |
| 287 'category': category, | 289 'category': category, |
| 288 'issue': issue, | 290 'issue': issue, |
| 289 'master': master, | 291 'master': master, |
| 290 'patch_project': issue_props['project'], | 292 'patch_project': issue_props['project'], |
| 291 'patch_storage': 'rietveld', | 293 'patch_storage': 'rietveld', |
| 292 'patchset': patchset, | 294 'patchset': patchset, |
| 293 'reason': options.name, | 295 'reason': options.name, |
| 294 'rietveld': rietveld_url, | 296 'rietveld': rietveld_url, |
| 295 'testfilter': tests, | |
| 296 }, | 297 }, |
| 297 } | 298 } |
| 299 if tests: |
| 300 parameters['properties']['testfilter'] = tests |
| 298 if properties: | 301 if properties: |
| 299 parameters['properties'].update(properties) | 302 parameters['properties'].update(properties) |
| 300 if options.clobber: | 303 if options.clobber: |
| 301 parameters['properties']['clobber'] = True | 304 parameters['properties']['clobber'] = True |
| 302 batch_req_body['builds'].append( | 305 batch_req_body['builds'].append( |
| 303 { | 306 { |
| 304 'bucket': bucket, | 307 'bucket': bucket, |
| 305 'parameters_json': json.dumps(parameters), | 308 'parameters_json': json.dumps(parameters), |
| 306 'tags': ['builder:%s' % builder, | 309 'tags': ['builder:%s' % builder, |
| 307 'buildset:%s' % buildset, | 310 'buildset:%s' % buildset, |
| (...skipping 2901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3209 # multiple try masters yet. | 3212 # multiple try masters yet. |
| 3210 old_style = filter(lambda x: isinstance(x, basestring), options.bot) | 3213 old_style = filter(lambda x: isinstance(x, basestring), options.bot) |
| 3211 new_style = filter(lambda x: isinstance(x, tuple), options.bot) | 3214 new_style = filter(lambda x: isinstance(x, tuple), options.bot) |
| 3212 | 3215 |
| 3213 for bot in old_style: | 3216 for bot in old_style: |
| 3214 if ':' in bot: | 3217 if ':' in bot: |
| 3215 parser.error('Specifying testfilter is no longer supported') | 3218 parser.error('Specifying testfilter is no longer supported') |
| 3216 elif ',' in bot: | 3219 elif ',' in bot: |
| 3217 parser.error('Specify one bot per --bot flag') | 3220 parser.error('Specify one bot per --bot flag') |
| 3218 else: | 3221 else: |
| 3219 builders_and_tests.setdefault(bot, []).append('defaulttests') | 3222 builders_and_tests.setdefault(bot, []) |
| 3220 | 3223 |
| 3221 for bot, tests in new_style: | 3224 for bot, tests in new_style: |
| 3222 builders_and_tests.setdefault(bot, []).extend(tests) | 3225 builders_and_tests.setdefault(bot, []).extend(tests) |
| 3223 | 3226 |
| 3224 # Return a master map with one master to be backwards compatible. The | 3227 # Return a master map with one master to be backwards compatible. The |
| 3225 # master name defaults to an empty string, which will cause the master | 3228 # master name defaults to an empty string, which will cause the master |
| 3226 # not to be set on rietveld (deprecated). | 3229 # not to be set on rietveld (deprecated). |
| 3227 return {options.master: builders_and_tests} | 3230 return {options.master: builders_and_tests} |
| 3228 | 3231 |
| 3229 masters = GetMasterMap() | 3232 masters = GetMasterMap() |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3667 if __name__ == '__main__': | 3670 if __name__ == '__main__': |
| 3668 # These affect sys.stdout so do it outside of main() to simplify mocks in | 3671 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 3669 # unit testing. | 3672 # unit testing. |
| 3670 fix_encoding.fix_encoding() | 3673 fix_encoding.fix_encoding() |
| 3671 colorama.init() | 3674 colorama.init() |
| 3672 try: | 3675 try: |
| 3673 sys.exit(main(sys.argv[1:])) | 3676 sys.exit(main(sys.argv[1:])) |
| 3674 except KeyboardInterrupt: | 3677 except KeyboardInterrupt: |
| 3675 sys.stderr.write('interrupted\n') | 3678 sys.stderr.write('interrupted\n') |
| 3676 sys.exit(1) | 3679 sys.exit(1) |
| OLD | NEW |