| Index: scripts/slave/recipes/infra/recipe_roll_tryjob.py
|
| diff --git a/scripts/slave/recipes/infra/recipe_roll_tryjob.py b/scripts/slave/recipes/infra/recipe_roll_tryjob.py
|
| index a50ea562222c0254a45b3cf7b63a5b35865c4b55..4bbe333afa3e70c7623391986bb38ca38442cd37 100644
|
| --- a/scripts/slave/recipes/infra/recipe_roll_tryjob.py
|
| +++ b/scripts/slave/recipes/infra/recipe_roll_tryjob.py
|
| @@ -181,17 +181,21 @@ RietveldPatch = collections.namedtuple(
|
| 'RietveldPatch', 'project server issue patchset')
|
|
|
|
|
| -def parse_patches(api, patches_raw):
|
| +def parse_patches(api, patches_raw, rietveld, issue, patchset, patch_project):
|
| """
|
| gives mapping of project to patch
|
| expect input of
|
| project1:https://a.b.c/1342342#ps1,project2:https://d.ce.f/1231231#ps1
|
| """
|
| - if not patches_raw:
|
| - return {}
|
| -
|
| result = {}
|
|
|
| + if rietveld and issue and patchset and patch_project:
|
| + result[patch_project] = RietveldPatch(
|
| + patch_project, rietveld, issue, patchset)
|
| +
|
| + if not patches_raw:
|
| + return result
|
| +
|
| for patch_raw in patches_raw.split(','):
|
| project, url = patch_raw.split(':', 1)
|
| server, issue_and_patchset = url.rsplit('/', 1)
|
| @@ -318,13 +322,27 @@ PROPERTIES = {
|
| "url.to.codereview is the address of the code review site"
|
| ", 123456 is the issue number, and ps01 is the patchset"
|
| "number"),
|
| + # This recipe can be used as a tryjob by setting the rietveld, issue, and
|
| + # patchset properties, like a normal tryjob. If those are set, it will use
|
| + # those, as well as any data sent in the regular properties, as patches to
|
| + # apply.
|
| + "rietveld": Property(kind=str, default="",
|
| + help="The code review site the tryjob patch isfrom"),
|
| + "issue": Property(kind=int, default=None,
|
| + help="The issue number this patch is from"),
|
| + "patchset": Property(kind=int, default=None,
|
| + help="The patchset to apply from this patch"),
|
| + "patch_project": Property(
|
| + kind=str, default=None,
|
| + help="The luci-config name of the project this patch belongs to"),
|
| }
|
|
|
| -def RunSteps(api, patches_raw):
|
| +def RunSteps(api, patches_raw, rietveld, issue, patchset, patch_project):
|
| auth_token = get_auth_token(api)
|
| headers = {'Authorization': 'Bearer %s' % auth_token}
|
|
|
| - patches = parse_patches(api, patches_raw)
|
| + patches = parse_patches(
|
| + api, patches_raw, rietveld, issue, patchset, patch_project)
|
|
|
| root_dir = api.path['slave_build']
|
|
|
| @@ -339,7 +357,7 @@ def RunSteps(api, patches_raw):
|
| recipe_configs = {
|
| p: get_project_config(api, p, headers) for p in all_projects}
|
|
|
| - downstream_projects, deps = get_deps_info(all_projects, recipe_configs)
|
| + deps, downstream_projects = get_deps_info(all_projects, recipe_configs)
|
|
|
| projs_to_test, locations = checkout_projects(
|
| api, all_projects, url_mapping, downstream_projects, root_dir, patches)
|
| @@ -408,3 +426,15 @@ def GenTests(api):
|
| api.step_data("Get recipe_engine deps", project('recipe_engine'))
|
| )
|
|
|
| + yield (
|
| + api.test('tryjob') +
|
| + api.properties(
|
| + rietveld="https://fake.code.review",
|
| + issue=12345678,
|
| + patchset=1,
|
| + patch_project="build",
|
| + ) +
|
| + api.step_data("Get build deps", project('build', ['recipe_engine'])) +
|
| + api.step_data("Get recipe_engine deps", project('recipe_engine'))
|
| + )
|
| +
|
|
|