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

Side by Side Diff: git_cl.py

Issue 1344183002: git cl try --luci, a set of hacks to demonstrate and iterate LUCI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Lint Created 5 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « .gitignore ('k') | luci_hacks/README.md » ('j') | 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 (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 21 matching lines...) Expand all
32 32
33 try: 33 try:
34 import readline # pylint: disable=F0401,W0611 34 import readline # pylint: disable=F0401,W0611
35 except ImportError: 35 except ImportError:
36 pass 36 pass
37 37
38 from third_party import colorama 38 from third_party import colorama
39 from third_party import httplib2 39 from third_party import httplib2
40 from third_party import upload 40 from third_party import upload
41 import auth 41 import auth
42 from luci_hacks import trigger_luci_job as luci_trigger
42 import breakpad # pylint: disable=W0611 43 import breakpad # pylint: disable=W0611
43 import clang_format 44 import clang_format
44 import dart_format 45 import dart_format
45 import fix_encoding 46 import fix_encoding
46 import gclient_utils 47 import gclient_utils
47 import git_common 48 import git_common
48 from git_footers import get_footer_svn_id 49 from git_footers import get_footer_svn_id
49 import owners 50 import owners
50 import owners_finder 51 import owners_finder
51 import presubmit_support 52 import presubmit_support
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 name, while the developers always use shortened master name 232 name, while the developers always use shortened master name
232 (tryserver.chromium.linux) by stripping off the prefix 'master.'. This 233 (tryserver.chromium.linux) by stripping off the prefix 'master.'. This
233 function does the conversion for buildbucket migration. 234 function does the conversion for buildbucket migration.
234 """ 235 """
235 prefix = 'master.' 236 prefix = 'master.'
236 if master.startswith(prefix): 237 if master.startswith(prefix):
237 return master 238 return master
238 return '%s%s' % (prefix, master) 239 return '%s%s' % (prefix, master)
239 240
240 241
242 def trigger_luci_job(changelist, masters, options):
243 """Send a job to run on LUCI."""
244 issue_props = changelist.GetIssueProperties()
245 issue = changelist.GetIssue()
246 patchset = changelist.GetMostRecentPatchset()
247 for builders_and_tests in sorted(masters.itervalues()):
248 for builder in sorted(builders_and_tests.iterkeys()):
249 luci_trigger.trigger(
250 builder, 'HEAD', issue, patchset, issue_props['project'])
251
252
241 def trigger_try_jobs(auth_config, changelist, options, masters, category): 253 def trigger_try_jobs(auth_config, changelist, options, masters, category):
242 rietveld_url = settings.GetDefaultServerUrl() 254 rietveld_url = settings.GetDefaultServerUrl()
243 rietveld_host = urlparse.urlparse(rietveld_url).hostname 255 rietveld_host = urlparse.urlparse(rietveld_url).hostname
244 authenticator = auth.get_authenticator_for_host(rietveld_host, auth_config) 256 authenticator = auth.get_authenticator_for_host(rietveld_host, auth_config)
245 http = authenticator.authorize(httplib2.Http()) 257 http = authenticator.authorize(httplib2.Http())
246 http.force_exception_to_status_code = True 258 http.force_exception_to_status_code = True
247 issue_props = changelist.GetIssueProperties() 259 issue_props = changelist.GetIssueProperties()
248 issue = changelist.GetIssue() 260 issue = changelist.GetIssue()
249 patchset = changelist.GetMostRecentPatchset() 261 patchset = changelist.GetMostRecentPatchset()
250 properties = _get_properties_from_options(options) 262 properties = _get_properties_from_options(options)
(...skipping 2826 matching lines...) Expand 10 before | Expand all | Expand 10 after
3077 group.add_option( 3089 group.add_option(
3078 "-b", "--bot", action="append", 3090 "-b", "--bot", action="append",
3079 help=("IMPORTANT: specify ONE builder per --bot flag. Use it multiple " 3091 help=("IMPORTANT: specify ONE builder per --bot flag. Use it multiple "
3080 "times to specify multiple builders. ex: " 3092 "times to specify multiple builders. ex: "
3081 "'-b win_rel -b win_layout'. See " 3093 "'-b win_rel -b win_layout'. See "
3082 "the try server waterfall for the builders name and the tests " 3094 "the try server waterfall for the builders name and the tests "
3083 "available.")) 3095 "available."))
3084 group.add_option( 3096 group.add_option(
3085 "-m", "--master", default='', 3097 "-m", "--master", default='',
3086 help=("Specify a try master where to run the tries.")) 3098 help=("Specify a try master where to run the tries."))
3099 group.add_option( "--luci", action='store_true')
3087 group.add_option( 3100 group.add_option(
3088 "-r", "--revision", 3101 "-r", "--revision",
3089 help="Revision to use for the try job; default: the " 3102 help="Revision to use for the try job; default: the "
3090 "revision will be determined by the try server; see " 3103 "revision will be determined by the try server; see "
3091 "its waterfall for more info") 3104 "its waterfall for more info")
3092 group.add_option( 3105 group.add_option(
3093 "-c", "--clobber", action="store_true", default=False, 3106 "-c", "--clobber", action="store_true", default=False,
3094 help="Force a clobber before building; e.g. don't do an " 3107 help="Force a clobber before building; e.g. don't do an "
3095 "incremental build") 3108 "incremental build")
3096 group.add_option( 3109 group.add_option(
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
3208 'Instead send your job to the parent.\n' 3221 'Instead send your job to the parent.\n'
3209 'Bot list: %s' % builders) 3222 'Bot list: %s' % builders)
3210 return 1 3223 return 1
3211 3224
3212 patchset = cl.GetMostRecentPatchset() 3225 patchset = cl.GetMostRecentPatchset()
3213 if patchset and patchset != cl.GetPatchset(): 3226 if patchset and patchset != cl.GetPatchset():
3214 print( 3227 print(
3215 '\nWARNING Mismatch between local config and server. Did a previous ' 3228 '\nWARNING Mismatch between local config and server. Did a previous '
3216 'upload fail?\ngit-cl try always uses latest patchset from rietveld. ' 3229 'upload fail?\ngit-cl try always uses latest patchset from rietveld. '
3217 'Continuing using\npatchset %s.\n' % patchset) 3230 'Continuing using\npatchset %s.\n' % patchset)
3218 if not options.use_rietveld: 3231 if options.luci:
3232 trigger_luci_job(cl, masters, options)
3233 elif not options.use_rietveld:
3219 try: 3234 try:
3220 trigger_try_jobs(auth_config, cl, options, masters, 'git_cl_try') 3235 trigger_try_jobs(auth_config, cl, options, masters, 'git_cl_try')
3221 except BuildbucketResponseException as ex: 3236 except BuildbucketResponseException as ex:
3222 print 'ERROR: %s' % ex 3237 print 'ERROR: %s' % ex
3223 return 1 3238 return 1
3224 except Exception as e: 3239 except Exception as e:
3225 stacktrace = (''.join(traceback.format_stack()) + traceback.format_exc()) 3240 stacktrace = (''.join(traceback.format_stack()) + traceback.format_exc())
3226 print 'ERROR: Exception when trying to trigger tryjobs: %s\n%s' % ( 3241 print 'ERROR: Exception when trying to trigger tryjobs: %s\n%s' % (
3227 e, stacktrace) 3242 e, stacktrace)
3228 return 1 3243 return 1
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
3596 if __name__ == '__main__': 3611 if __name__ == '__main__':
3597 # These affect sys.stdout so do it outside of main() to simplify mocks in 3612 # These affect sys.stdout so do it outside of main() to simplify mocks in
3598 # unit testing. 3613 # unit testing.
3599 fix_encoding.fix_encoding() 3614 fix_encoding.fix_encoding()
3600 colorama.init() 3615 colorama.init()
3601 try: 3616 try:
3602 sys.exit(main(sys.argv[1:])) 3617 sys.exit(main(sys.argv[1:]))
3603 except KeyboardInterrupt: 3618 except KeyboardInterrupt:
3604 sys.stderr.write('interrupted\n') 3619 sys.stderr.write('interrupted\n')
3605 sys.exit(1) 3620 sys.exit(1)
OLDNEW
« no previous file with comments | « .gitignore ('k') | luci_hacks/README.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698