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

Side by Side Diff: scripts/slave/recipe_modules/chromite/api.py

Issue 2166673002: Pass buildbucket.build.id to cbuildbot as --buildbucket-id. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 import cgi 5 import cgi
6 import json
dnj (Google) 2016/07/20 01:37:06 We actually have a recipe module called "json": ht
nxia1 2016/07/20 05:24:22 looks like it's already imported.
6 import re 7 import re
7 8
8 from recipe_engine import recipe_api 9 from recipe_engine import recipe_api
9 10
10 11
11 class Config(object): 12 class Config(object):
12 _NONE = object() 13 _NONE = object()
13 14
14 def __init__(self, name, *layers): 15 def __init__(self, name, *layers):
15 self.name = name 16 self.name = name
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 63
63 def get_config_defaults(self): 64 def get_config_defaults(self):
64 defaults = { 65 defaults = {
65 'CBB_CONFIG': self.m.properties.get('cbb_config'), 66 'CBB_CONFIG': self.m.properties.get('cbb_config'),
66 'CBB_BRANCH': self.m.properties.get('cbb_branch'), 67 'CBB_BRANCH': self.m.properties.get('cbb_branch'),
67 'CBB_DEBUG': self.m.properties.get('cbb_debug') is not None, 68 'CBB_DEBUG': self.m.properties.get('cbb_debug') is not None,
68 'CBB_CLOBBER': 'clobber' in self.m.properties, 69 'CBB_CLOBBER': 'clobber' in self.m.properties,
69 } 70 }
70 if 'buildnumber' in self.m.properties: 71 if 'buildnumber' in self.m.properties:
71 defaults['CBB_BUILD_NUMBER'] = int(self.m.properties['buildnumber']) 72 defaults['CBB_BUILD_NUMBER'] = int(self.m.properties['buildnumber'])
73
74 if 'buildbucket' in self.m.properties:
75 buildbucket_json = json.loads(self.m.properties.get('buildbucket'))
dnj (Google) 2016/07/20 01:37:06 Use recipe module "self.m.json.loads" here instead
nxia1 2016/07/20 05:24:22 Done.
76 defaults['CBB_BUILDBUCKET_ID'] = buildbucket_json['build']['id']
77
72 return defaults 78 return defaults
73 79
74 def _load_config_dump(self): 80 def _load_config_dump(self):
75 if not self._cached_config: 81 if not self._cached_config:
76 config_path = self.m.path.join(self.chromite_path, 82 config_path = self.m.path.join(self.chromite_path,
77 'cbuildbot', 'config_dump.json') 83 'cbuildbot', 'config_dump.json')
78 step_result = self.m.json.read('read chromite config', config_path, 84 step_result = self.m.json.read('read chromite config', config_path,
79 add_json_log=False) 85 add_json_log=False)
80 self._cached_config = step_result.json.output 86 self._cached_config = step_result.json.output
81 return self._cached_config 87 return self._cached_config
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 if self.c.cbb.chrome_rev: 347 if self.c.cbb.chrome_rev:
342 cbb_args.extend(['--chrome_rev', self.c.cbb.chrome_rev]) 348 cbb_args.extend(['--chrome_rev', self.c.cbb.chrome_rev])
343 if self.c.cbb.debug: 349 if self.c.cbb.debug:
344 cbb_args.extend(['--debug']) 350 cbb_args.extend(['--debug'])
345 if self.c.cbb.clobber: 351 if self.c.cbb.clobber:
346 cbb_args.extend(['--clobber']) 352 cbb_args.extend(['--clobber'])
347 if self.c.cbb.chrome_version: 353 if self.c.cbb.chrome_version:
348 cbb_args.extend(['--chrome_version', self.c.cbb.chrome_version]) 354 cbb_args.extend(['--chrome_version', self.c.cbb.chrome_version])
349 if self.c.cbb.config_repo: 355 if self.c.cbb.config_repo:
350 cbb_args.extend(['--config_repo', self.c.cbb.config_repo]) 356 cbb_args.extend(['--config_repo', self.c.cbb.config_repo])
357 if self.c.cbb.buildbucket_id:
358 cbb_args.extend(['--buildbucket-id', self.c.cbb.buildbucket_id])
351 if self.c.repo_cache_dir and self.c.cbb.supports_repo_cache: 359 if self.c.repo_cache_dir and self.c.cbb.supports_repo_cache:
352 cbb_args.extend(['--repo-cache', self.c.repo_cache_dir]) 360 cbb_args.extend(['--repo-cache', self.c.repo_cache_dir])
353 361
354 # Set the build ID, if specified. 362 # Set the build ID, if specified.
355 if self.c.cbb.build_id: 363 if self.c.cbb.build_id:
356 cbb_args.extend(['--master-build-id', self.c.cbb.build_id]) 364 cbb_args.extend(['--master-build-id', self.c.cbb.build_id])
357 365
358 # Add custom args, if there are any. 366 # Add custom args, if there are any.
359 cbb_args.extend(args) 367 cbb_args.extend(args)
360 368
361 # Run cbuildbot. 369 # Run cbuildbot.
362 return self.cbuildbot(str('cbuildbot [%s]' % (self.c.cbb.config,)), 370 return self.cbuildbot(str('cbuildbot [%s]' % (self.c.cbb.config,)),
363 self.c.cbb.config, 371 self.c.cbb.config,
364 args=cbb_args, 372 args=cbb_args,
365 cwd=self.m.path['slave_build']) 373 cwd=self.m.path['slave_build'])
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/chromite/config.py » ('j') | scripts/slave/recipes/cros/cbuildbot_tryjob.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698