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

Side by Side Diff: infra/bots/recipes/swarmbucket_wrapper.py

Issue 2185203003: Add swarmbucket_wrapper recipe (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | infra/bots/recipes/swarmbucket_wrapper.expected/trigger_recipe.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5
6 # Recipe wrapper used in SwarmBucket.
7
8
9 DEPS = [
10 'build/file',
11 'depot_tools/bot_update',
12 'depot_tools/gclient',
13 'recipe_engine/json',
14 'recipe_engine/path',
15 'recipe_engine/properties',
16 'recipe_engine/python',
17 'recipe_engine/step',
18 ]
19
20
21 def checkout_steps(api):
rmistry 2016/07/28 17:41:48 Can we add a bunch of documentation and line break
borenet 2016/07/28 17:46:00 Done. Honestly, I'm not sure what most of the opti
22 """Run the steps to obtain a checkout of Skia."""
23 workdir = api.path['b'].join('work')
24 if not api.path.exists(workdir):
25 api.file.makedirs('workdir', workdir, infra_step=True)
26 cache_dir = api.path['b'].join('cache')
27 api.gclient.use_mirror = True
28 gclient_cfg = api.gclient.make_config(GIT_MODE=True, CACHE_DIR=cache_dir)
29 soln = gclient_cfg.solutions.add()
30 soln.name = 'skia'
31 soln.url = 'https://skia.googlesource.com/skia.git'
32 soln.revision = api.properties.get('revision', 'origin/master')
33 api.gclient.c = gclient_cfg
34 api.gclient.c.got_revision_mapping['skia'] = 'got_revision'
35 patch = api.properties.get('patch', True)
36 clobber = True if api.properties.get('clobber') else False
37 force = True if api.properties.get('force') else False
38 no_shallow = True if api.properties.get('no_shallow') else False
39 output_manifest = api.properties.get('output_manifest', False)
40 with_branch_heads = api.properties.get('with_branch_heads', False)
41 refs = api.properties.get('refs', [])
42 oauth2 = api.properties.get('oauth2', False)
43 root_solution_revision = api.properties.get('root_solution_revision')
44 suffix = api.properties.get('suffix')
45 gerrit_no_reset = True if api.properties.get('gerrit_no_reset') else False
46 api.bot_update.ensure_checkout(force=force,
47 no_shallow=no_shallow,
48 patch=patch,
49 with_branch_heads=with_branch_heads,
50 output_manifest=output_manifest,
51 refs=refs, patch_oauth2=oauth2,
52 clobber=clobber,
53 root_solution_revision=root_solution_revision,
54 suffix=suffix,
55 gerrit_no_reset=gerrit_no_reset,
56 cwd=workdir)
57 got_revision = api.step.active_result.presentation.properties['got_revision']
58 if soln.revision != 'origin/master': # pragma: no cover
59 assert got_revision == soln.revision
60 return got_revision
61
62
63 def forward_to_recipe_in_repo(api):
64 workdir = api.path['b'].join('work')
65 recipes_py = workdir.join('skia', 'infra', 'bots', 'recipes.py')
66 cmd = ['python', recipes_py, 'run',
67 '--workdir', workdir,
68 'swarm_trigger', 'path_config=kitchen']
69 for k, v in api.properties.iteritems():
70 cmd.append('%s=%s' % (k, v))
71 api.step('run recipe', cmd=cmd, allow_subannotations=True)
72
73
74 def print_properties(api):
75 """Dump out all properties for debugging purposes."""
76 props = {}
77 for k, v in api.properties.iteritems():
78 props[k] = v
79 api.python.inline(
80 'print properties',
81 '''
82 import json
83 import sys
84
85 with open(sys.argv[1]) as f:
86 content = json.load(f)
87
88 print json.dumps(content, indent=2)
89 ''',
90 args=[api.json.input(props)])
91
92
93 def RunSteps(api):
94 api.path.c.base_paths['b'] = ('/', 'b')
95
96 # TODO(borenet): Remove this once SwarmBucket is working.
97 print_properties(api)
98
99 checkout_steps(api)
100 forward_to_recipe_in_repo(api)
101
102
103 def GenTests(api):
104 yield (
105 api.test('trigger_recipe') +
106 api.properties(buildername='Some-Builder',
107 buildnumber=5,
108 mastername='client.skia.fyi',
109 slavename='some-slave',
110 path_config='swarmbucket')
111 )
OLDNEW
« no previous file with comments | « no previous file | infra/bots/recipes/swarmbucket_wrapper.expected/trigger_recipe.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698