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

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

Issue 2190933002: Fixes for SwarmBucket bot (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix print_properties 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/swarm_trigger.expected/Build-Mac-Clang-x86_64-Release.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 # Recipe module for Skia Swarming trigger. 6 # Recipe module for Skia Swarming trigger.
7 7
8 8
9 import json 9 import json
10 10
11 11
12 DEPS = [ 12 DEPS = [
13 'build/file', 13 'build/file',
14 'build/gsutil', 14 'build/gsutil',
15 'depot_tools/depot_tools', 15 'depot_tools/depot_tools',
16 'depot_tools/git', 16 'depot_tools/git',
17 'depot_tools/tryserver', 17 'depot_tools/tryserver',
18 'recipe_engine/json',
18 'recipe_engine/path', 19 'recipe_engine/path',
19 'recipe_engine/properties', 20 'recipe_engine/properties',
20 'recipe_engine/python', 21 'recipe_engine/python',
21 'recipe_engine/raw_io', 22 'recipe_engine/raw_io',
22 'recipe_engine/step', 23 'recipe_engine/step',
23 'recipe_engine/time', 24 'recipe_engine/time',
24 'skia', 25 'skia',
25 'skia_swarming', 26 'skia_swarming',
26 ] 27 ]
27 28
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 expiration=expiration, 209 expiration=expiration,
209 hard_timeout=hard_timeout, 210 hard_timeout=hard_timeout,
210 io_timeout=io_timeout, 211 io_timeout=io_timeout,
211 cipd_packages=cipd_packages) 212 cipd_packages=cipd_packages)
212 213
213 214
214 def checkout_steps(api): 215 def checkout_steps(api):
215 """Run the steps to obtain a checkout of Skia.""" 216 """Run the steps to obtain a checkout of Skia."""
216 # In this case, we're already running inside a checkout of Skia, so just 217 # In this case, we're already running inside a checkout of Skia, so just
217 # report the currently-checked-out commit. 218 # report the currently-checked-out commit.
218 checkout_path = api.path['root'].join('skia') 219 checkout_path = api.path['slave_build'].join('skia')
219 got_revision = api.git( 220 got_revision = api.git(
220 'rev-parse', 'HEAD', cwd=checkout_path, 221 'rev-parse', 'HEAD', cwd=checkout_path,
221 stdout=api.raw_io.output(), 222 stdout=api.raw_io.output(),
222 step_test_data=lambda: api.raw_io.test_api.stream_output('abc123\n'), 223 step_test_data=lambda: api.raw_io.test_api.stream_output('abc123\n'),
223 ).stdout.rstrip() 224 ).stdout.rstrip()
224 cmd = ['python', '-c', '"print \'%s\'"' % got_revision] 225 cmd = ['python', '-c', '"print \'%s\'"' % got_revision]
225 res = api.step('got_revision', cmd=cmd) 226 res = api.step('got_revision', cmd=cmd)
226 res.presentation.properties['got_revision'] = got_revision 227 res.presentation.properties['got_revision'] = got_revision
227 api.path['checkout'] = checkout_path 228 api.path['checkout'] = checkout_path
229
230 # Write a fake .gclient file if none exists. This is required by .isolates.
231 dot_gclient = api.path['slave_build'].join('.gclient')
232 if not api.path.exists(dot_gclient):
233 api.skia._writefile(dot_gclient, '')
234
228 fix_filemodes(api, api.path['checkout']) 235 fix_filemodes(api, api.path['checkout'])
229 return got_revision 236 return got_revision
230 237
231 238
232 def housekeeper_swarm(api, builder_spec, got_revision, infrabots_dir, 239 def housekeeper_swarm(api, builder_spec, got_revision, infrabots_dir,
233 extra_isolate_hashes): 240 extra_isolate_hashes):
234 task = trigger_task( 241 task = trigger_task(
235 api, 242 api,
236 'housekeeper', 243 'housekeeper',
237 api.properties['buildername'], 244 api.properties['buildername'],
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 def cipd_pkg(api, infrabots_dir, asset_name): 552 def cipd_pkg(api, infrabots_dir, asset_name):
546 """Find and return the CIPD package info for the given asset.""" 553 """Find and return the CIPD package info for the given asset."""
547 version_file = infrabots_dir.join('assets', asset_name, 'VERSION') 554 version_file = infrabots_dir.join('assets', asset_name, 'VERSION')
548 version = api.skia._readfile(version_file, 555 version = api.skia._readfile(version_file,
549 name='read %s VERSION' % asset_name, 556 name='read %s VERSION' % asset_name,
550 test_data='0').rstrip() 557 test_data='0').rstrip()
551 version = 'version:%s' % version 558 version = 'version:%s' % version
552 return (asset_name, 'skia/bots/%s' % asset_name, version) 559 return (asset_name, 'skia/bots/%s' % asset_name, version)
553 560
554 561
562 def print_properties(api):
563 """Dump out all properties for debugging purposes."""
564 props = {}
565 for k, v in api.properties.iteritems():
566 props[k] = v
567 api.python.inline(
568 'print properties',
569 '''
570 import json
571 import sys
572
573 with open(sys.argv[1]) as f:
574 content = json.load(f)
575
576 print json.dumps(content, indent=2)
577 ''',
578 args=[api.json.input(props)])
579
580
555 def RunSteps(api): 581 def RunSteps(api):
582 # TODO(borenet): Remove this once SwarmBucket is working.
583 print_properties(api)
584
556 got_revision = checkout_steps(api) 585 got_revision = checkout_steps(api)
557 infrabots_dir = api.path['checkout'].join('infra', 'bots') 586 infrabots_dir = api.path['checkout'].join('infra', 'bots')
558 api.skia_swarming.setup( 587 api.skia_swarming.setup(
559 infrabots_dir.join('tools', 'luci-go'), 588 infrabots_dir.join('tools', 'luci-go'),
560 swarming_rev='') 589 swarming_rev='')
561 590
562 # Run gsutil.py to ensure that it's installed. 591 # Run gsutil.py to ensure that it's installed.
563 api.gsutil(['help']) 592 api.gsutil(['help'])
564 593
565 extra_hashes = [] 594 extra_hashes = []
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 test += api.path.exists(*paths) 708 test += api.path.exists(*paths)
680 709
681 return test 710 return test
682 711
683 712
684 def GenTests(api): 713 def GenTests(api):
685 for mastername, slaves in TEST_BUILDERS.iteritems(): 714 for mastername, slaves in TEST_BUILDERS.iteritems():
686 for slavename, builders_by_slave in slaves.iteritems(): 715 for slavename, builders_by_slave in slaves.iteritems():
687 for builder in builders_by_slave: 716 for builder in builders_by_slave:
688 yield test_for_bot(api, builder, mastername, slavename) 717 yield test_for_bot(api, builder, mastername, slavename)
OLDNEW
« no previous file with comments | « no previous file | infra/bots/recipes/swarm_trigger.expected/Build-Mac-Clang-x86_64-Release.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698