Commit f9648b5c authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by Commit Bot

git cl try: support custom --category.

Over last two weeks of running tryjobs on CLs of others, I found
this very useful. This CL also simplifies code.

R=agable@chromium.org

Change-Id: I5c7ce0d311b1ca024b92227dbec54e5197205c62
Reviewed-on: https://chromium-review.googlesource.com/930742Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
parent 72272996
...@@ -426,8 +426,7 @@ def _get_bucket_map_for_builders(builders): ...@@ -426,8 +426,7 @@ def _get_bucket_map_for_builders(builders):
return bucket_map, None return bucket_map, None
def _trigger_try_jobs(auth_config, changelist, buckets, options, def _trigger_try_jobs(auth_config, changelist, buckets, options, patchset):
category='git_cl_try', patchset=None):
"""Sends a request to Buildbucket to trigger try jobs for a changelist. """Sends a request to Buildbucket to trigger try jobs for a changelist.
Args: Args:
...@@ -457,7 +456,7 @@ def _trigger_try_jobs(auth_config, changelist, buckets, options, ...@@ -457,7 +456,7 @@ def _trigger_try_jobs(auth_config, changelist, buckets, options,
patch=patchset) patch=patchset)
shared_parameters_properties = changelist.GetTryJobProperties(patchset) shared_parameters_properties = changelist.GetTryJobProperties(patchset)
shared_parameters_properties['category'] = category shared_parameters_properties['category'] = options.category
if options.clobber: if options.clobber:
shared_parameters_properties['clobber'] = True shared_parameters_properties['clobber'] = True
extra_properties = _get_properties_from_options(options) extra_properties = _get_properties_from_options(options)
...@@ -5540,6 +5539,8 @@ def CMDtry(parser, args): ...@@ -5540,6 +5539,8 @@ def CMDtry(parser, args):
'-c', '--clobber', action='store_true', default=False, '-c', '--clobber', action='store_true', default=False,
help='Force a clobber before building; that is don\'t do an ' help='Force a clobber before building; that is don\'t do an '
'incremental build') 'incremental build')
group.add_option(
'--category', default='git_cl_try', help='Specify custom build category.')
group.add_option( group.add_option(
'--project', '--project',
help='Override which project to use. Projects are defined ' help='Override which project to use. Projects are defined '
...@@ -5619,8 +5620,7 @@ def CMDtry(parser, args): ...@@ -5619,8 +5620,7 @@ def CMDtry(parser, args):
(patchset, cl.GetPatchset(), patchset)) (patchset, cl.GetPatchset(), patchset))
try: try:
_trigger_try_jobs(auth_config, cl, buckets, options, 'git_cl_try', _trigger_try_jobs(auth_config, cl, buckets, options, patchset)
patchset)
except BuildbucketResponseException as ex: except BuildbucketResponseException as ex:
print('ERROR: %s' % ex) print('ERROR: %s' % ex)
return 1 return 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment