| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 return v | 57 return v |
| 58 return self.m.path['slave_build'].join(self._chromite_subpath) | 58 return self.m.path['slave_build'].join(self._chromite_subpath) |
| 59 | 59 |
| 60 def _set_chromite_path(self, path): | 60 def _set_chromite_path(self, path): |
| 61 self.m.path.c.dynamic_paths['chromite'] = path | 61 self.m.path.c.dynamic_paths['chromite'] = path |
| 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_MASTER_BUILD_ID': self.m.properties.get('cbb_master_build_id'), |
| 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']) |
| 72 | 73 |
| 73 buildbucket_props = self.m.buildbucket.properties | 74 buildbucket_props = self.m.buildbucket.properties |
| 74 if buildbucket_props: | 75 if buildbucket_props: |
| 75 defaults['CBB_BUILDBUCKET_ID'] = buildbucket_props['build']['id'] | 76 defaults['CBB_BUILDBUCKET_ID'] = buildbucket_props['build']['id'] |
| 76 | 77 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 """Loads manifest-specified parameters from the manifest commit. | 142 """Loads manifest-specified parameters from the manifest commit. |
| 142 | 143 |
| 143 This method parses the commit log for the following information: | 144 This method parses the commit log for the following information: |
| 144 - The branch to build (From the "Automatic": tag). | 145 - The branch to build (From the "Automatic": tag). |
| 145 - The build ID (from the CrOS-Build-Id: tag). | 146 - The build ID (from the CrOS-Build-Id: tag). |
| 146 | 147 |
| 147 Args: | 148 Args: |
| 148 repository (str): The URL of the repository hosting the change. | 149 repository (str): The URL of the repository hosting the change. |
| 149 revision (str): The revision hash to load the build ID from. | 150 revision (str): The revision hash to load the build ID from. |
| 150 """ | 151 """ |
| 152 if all((self.c.chromite_branch, self.c.cbb.build_id)): |
| 153 # They have all already been populated, so we're done (BuildBucket). |
| 154 return |
| 155 |
| 156 # Load our manifest fields from the formatted Gitiles commit message that |
| 157 # scheduled this build. |
| 158 # |
| 159 # First, check that we are actually in a known manifest Gitiles repository. |
| 160 if not self.check_repository('cros_manifest', repository): |
| 161 return |
| 162 |
| 151 commit_log = self.m.gitiles.commit_log( | 163 commit_log = self.m.gitiles.commit_log( |
| 152 repository, revision, step_name='Fetch manifest config', | 164 repository, revision, step_name='Fetch manifest config', |
| 153 attempts=self._GITILES_ATTEMPTS) | 165 attempts=self._GITILES_ATTEMPTS) |
| 154 result = self.m.step.active_result | 166 result = self.m.step.active_result |
| 155 | 167 |
| 156 # Handle missing/invalid response. | 168 # Handle missing/invalid response. |
| 157 if not (commit_log and commit_log.get('message')): | 169 if not (commit_log and commit_log.get('message')): |
| 158 self.m.python.failing_step('Fetch manifest config failure', | 170 self.m.python.failing_step('Fetch manifest config failure', |
| 159 'Failed to fetch manifest config.') | 171 'Failed to fetch manifest config.') |
| 160 | 172 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 repository = self.m.properties.get('repository') | 383 repository = self.m.properties.get('repository') |
| 372 revision = self.m.properties.get('revision') | 384 revision = self.m.properties.get('revision') |
| 373 if repository and revision: | 385 if repository and revision: |
| 374 # Pull more information from the commit if it came from certain known | 386 # Pull more information from the commit if it came from certain known |
| 375 # repositories. | 387 # repositories. |
| 376 if (self.c.use_chrome_version and | 388 if (self.c.use_chrome_version and |
| 377 self.check_repository('chromium', repository)): | 389 self.check_repository('chromium', repository)): |
| 378 # If our change comes from a Chromium repository, add the | 390 # If our change comes from a Chromium repository, add the |
| 379 # '--chrome_version' flag. | 391 # '--chrome_version' flag. |
| 380 self.c.cbb.chrome_version = self.m.properties['revision'] | 392 self.c.cbb.chrome_version = self.m.properties['revision'] |
| 381 if (self.c.read_cros_manifest and | 393 |
| 382 self.check_repository('cros_manifest', repository)): | 394 if self.c.read_cros_manifest: |
| 383 # This change comes from a manifest repository. Load configuration | 395 # This change comes from a manifest repository. Load configuration |
| 384 # parameters from the manifest command. | 396 # parameters from the manifest command. |
| 385 self.load_manifest_config(repository, revision) | 397 self.load_manifest_config(repository, revision) |
| 386 | 398 |
| 387 buildroot = self.m.path['root'].join('cbuild', self.c.cbb.builddir) | 399 buildroot = self.m.path['root'].join('cbuild', self.c.cbb.builddir) |
| 388 cbb_args = [ | 400 cbb_args = [ |
| 389 '--buildroot', buildroot, | 401 '--buildroot', buildroot, |
| 390 ] | 402 ] |
| 391 if not args: | 403 if not args: |
| 392 cbb_args.append('--buildbot') | 404 cbb_args.append('--buildbot') |
| (...skipping 21 matching lines...) Expand all Loading... |
| 414 cbb_args.extend(['--master-build-id', self.c.cbb.build_id]) | 426 cbb_args.extend(['--master-build-id', self.c.cbb.build_id]) |
| 415 | 427 |
| 416 # Add custom args, if there are any. | 428 # Add custom args, if there are any. |
| 417 cbb_args.extend(args) | 429 cbb_args.extend(args) |
| 418 | 430 |
| 419 # Run cbuildbot. | 431 # Run cbuildbot. |
| 420 return self.cbuildbot(str('cbuildbot [%s]' % (self.c.cbb.config,)), | 432 return self.cbuildbot(str('cbuildbot [%s]' % (self.c.cbb.config,)), |
| 421 self.c.cbb.config, | 433 self.c.cbb.config, |
| 422 args=cbb_args, | 434 args=cbb_args, |
| 423 cwd=self.m.path['slave_build']) | 435 cwd=self.m.path['slave_build']) |
| OLD | NEW |