diff options
Diffstat (limited to 'cbuildbot/stages/build_stages.py')
-rw-r--r-- | cbuildbot/stages/build_stages.py | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/cbuildbot/stages/build_stages.py b/cbuildbot/stages/build_stages.py index 44b721efa..9533887b5 100644 --- a/cbuildbot/stages/build_stages.py +++ b/cbuildbot/stages/build_stages.py @@ -205,17 +205,14 @@ class SetupBoardStage(generic_stages.BoardSpecificBuilderStage, InitSDKStage): self._build_root, toolchain_boards=[self._current_board], usepkg=usepkg_toolchain) - # Only update the board if we need to do so. - chroot_path = os.path.join(self._build_root, constants.DEFAULT_CHROOT_DIR) - board_path = os.path.join(chroot_path, 'build', self._current_board) - if not os.path.isdir(board_path) or self._run.config.board_replace: - usepkg = self._run.config.usepkg_build_packages - commands.SetupBoard( - self._build_root, board=self._current_board, usepkg=usepkg, - chrome_binhost_only=self._run.config.chrome_binhost_only, - force=self._run.config.board_replace, - extra_env=self._portage_extra_env, chroot_upgrade=False, - profile=self._run.options.profile or self._run.config.profile) + # Always update the board. + usepkg = self._run.config.usepkg_build_packages + commands.SetupBoard( + self._build_root, board=self._current_board, usepkg=usepkg, + chrome_binhost_only=self._run.config.chrome_binhost_only, + force=self._run.config.board_replace, + extra_env=self._portage_extra_env, chroot_upgrade=False, + profile=self._run.options.profile or self._run.config.profile) class BuildPackagesStage(generic_stages.BoardSpecificBuilderStage, @@ -379,7 +376,8 @@ class BuildImageStage(BuildPackagesStage): self.board_runattrs.SetParallel('images_generated', True) parallel.RunParallelSteps( - [self._BuildVMImage, lambda: self._GenerateAuZip(cbuildbot_image_link)]) + [self._BuildVMImage, lambda: self._GenerateAuZip(cbuildbot_image_link), + self._BuildGceTarballs]) def _BuildVMImage(self): if self._run.config.vm_tests and not self._afdo_generate_min: @@ -395,6 +393,28 @@ class BuildImageStage(BuildPackagesStage): image_dir, extra_env=self._portage_extra_env) + def _BuildGceTarballs(self): + """Creates .tar.gz files that can be converted to GCE images. + + These files will be used by VMTestStage for tests on GCE. They will also be + be uploaded to GCS buckets, where they can be used as input to the "gcloud + compute images create" command. This will convert them into images that can + be used to create GCE VM instances. + """ + if self._run.config.upload_gce_images: + image_bins = [] + if 'base' in self._run.config['images']: + image_bins.append(constants.IMAGE_TYPE_TO_NAME['base']) + if 'test' in self._run.config['images']: + image_bins.append(constants.IMAGE_TYPE_TO_NAME['test']) + + image_dir = self.GetImageDirSymlink('latest') + for image_bin in image_bins: + if os.path.exists(os.path.join(image_dir, image_bin)): + commands.BuildGceTarball(image_dir, image_dir, image_bin) + else: + logging.warning('Missing image file skipped: %s', image_bin) + def _HandleStageException(self, exc_info): """Tell other stages to not wait on us if we die for some reason.""" self.board_runattrs.SetParallelDefault('images_generated', False) |