| OLD | NEW |
| 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 re | 6 import re |
| 7 | 7 |
| 8 from recipe_engine import recipe_api | 8 from recipe_engine import recipe_api |
| 9 | 9 |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 def get_config_defaults(self): | 63 def get_config_defaults(self): |
| 64 defaults = { | 64 defaults = { |
| 65 'CBB_CONFIG': self.m.properties.get('cbb_config'), | 65 'CBB_CONFIG': self.m.properties.get('cbb_config'), |
| 66 'CBB_BRANCH': self.m.properties.get('cbb_branch'), | 66 'CBB_BRANCH': self.m.properties.get('cbb_branch'), |
| 67 'CBB_DEBUG': self.m.properties.get('cbb_debug') is not None, | 67 'CBB_DEBUG': self.m.properties.get('cbb_debug') is not None, |
| 68 'CBB_CLOBBER': 'clobber' in self.m.properties, | 68 'CBB_CLOBBER': 'clobber' in self.m.properties, |
| 69 } | 69 } |
| 70 if 'buildnumber' in self.m.properties: | 70 if 'buildnumber' in self.m.properties: |
| 71 defaults['CBB_BUILD_NUMBER'] = int(self.m.properties['buildnumber']) | 71 defaults['CBB_BUILD_NUMBER'] = int(self.m.properties['buildnumber']) |
| 72 |
| 73 if 'buildbucket' in self.m.properties: |
| 74 buildbucket_json = self.m.json.loads(self.m.properties.get('buildbucket')) |
| 75 defaults['CBB_BUILDBUCKET_ID'] = buildbucket_json['build']['id'] |
| 76 |
| 72 return defaults | 77 return defaults |
| 73 | 78 |
| 74 def _load_config_dump(self): | 79 def _load_config_dump(self): |
| 75 if not self._cached_config: | 80 if not self._cached_config: |
| 76 config_path = self.m.path.join(self.chromite_path, | 81 config_path = self.m.path.join(self.chromite_path, |
| 77 'cbuildbot', 'config_dump.json') | 82 'cbuildbot', 'config_dump.json') |
| 78 step_result = self.m.json.read('read chromite config', config_path, | 83 step_result = self.m.json.read('read chromite config', config_path, |
| 79 add_json_log=False) | 84 add_json_log=False) |
| 80 self._cached_config = step_result.json.output | 85 self._cached_config = step_result.json.output |
| 81 return self._cached_config | 86 return self._cached_config |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 if self.c.cbb.chrome_rev: | 346 if self.c.cbb.chrome_rev: |
| 342 cbb_args.extend(['--chrome_rev', self.c.cbb.chrome_rev]) | 347 cbb_args.extend(['--chrome_rev', self.c.cbb.chrome_rev]) |
| 343 if self.c.cbb.debug: | 348 if self.c.cbb.debug: |
| 344 cbb_args.extend(['--debug']) | 349 cbb_args.extend(['--debug']) |
| 345 if self.c.cbb.clobber: | 350 if self.c.cbb.clobber: |
| 346 cbb_args.extend(['--clobber']) | 351 cbb_args.extend(['--clobber']) |
| 347 if self.c.cbb.chrome_version: | 352 if self.c.cbb.chrome_version: |
| 348 cbb_args.extend(['--chrome_version', self.c.cbb.chrome_version]) | 353 cbb_args.extend(['--chrome_version', self.c.cbb.chrome_version]) |
| 349 if self.c.cbb.config_repo: | 354 if self.c.cbb.config_repo: |
| 350 cbb_args.extend(['--config_repo', self.c.cbb.config_repo]) | 355 cbb_args.extend(['--config_repo', self.c.cbb.config_repo]) |
| 356 if self.c.cbb.buildbucket_id: |
| 357 cbb_args.extend(['--buildbucket-id', self.c.cbb.buildbucket_id]) |
| 351 if self.c.repo_cache_dir and self.c.cbb.supports_repo_cache: | 358 if self.c.repo_cache_dir and self.c.cbb.supports_repo_cache: |
| 352 cbb_args.extend(['--repo-cache', self.c.repo_cache_dir]) | 359 cbb_args.extend(['--repo-cache', self.c.repo_cache_dir]) |
| 353 | 360 |
| 354 # Set the build ID, if specified. | 361 # Set the build ID, if specified. |
| 355 if self.c.cbb.build_id: | 362 if self.c.cbb.build_id: |
| 356 cbb_args.extend(['--master-build-id', self.c.cbb.build_id]) | 363 cbb_args.extend(['--master-build-id', self.c.cbb.build_id]) |
| 357 | 364 |
| 358 # Add custom args, if there are any. | 365 # Add custom args, if there are any. |
| 359 cbb_args.extend(args) | 366 cbb_args.extend(args) |
| 360 | 367 |
| 361 # Run cbuildbot. | 368 # Run cbuildbot. |
| 362 return self.cbuildbot(str('cbuildbot [%s]' % (self.c.cbb.config,)), | 369 return self.cbuildbot(str('cbuildbot [%s]' % (self.c.cbb.config,)), |
| 363 self.c.cbb.config, | 370 self.c.cbb.config, |
| 364 args=cbb_args, | 371 args=cbb_args, |
| 365 cwd=self.m.path['slave_build']) | 372 cwd=self.m.path['slave_build']) |
| OLD | NEW |