def _Run(self, build_config): """Prepare and run a BinhostConfWriter. Args: build_config: Name of build config to run for. """ self._Prepare(build_config) confwriter = prebuilts.BinhostConfWriter(self._run) confwriter.Perform()
def PerformStage(self): # Either has to be a master or not have any push overlays. assert self._run.config.master assert self._run.config.push_overlays # If we're a commit queue, we should clean out our local changes, resync, # and reapply our uprevs. This is necessary so that 1) we are sure to point # at the remote SHA1s, not our local SHA1s; 2) we can avoid doing a # rebase; 3) in the case of failure and staging_branch is None, we don't # submit the changes that were committed locally. # # If we're not a commit queue and the build succeeded, we can skip the # cleanup here. This is a cheap trick so that the Chrome PFQ pushes its # earlier uprev from the SyncChrome stage (it would be a bit tricky to # replicate the uprev here, so we'll leave it alone). # If we're not a commit queue and staging_branch is not None, we can skip # the cleanup here. When staging_branch is not None, we're going to push # the local commits generated in AFDOUpdateEbuild stage to the # staging_branch, cleaning up repository here will wipe out the local # commits. if not self.success: repo = self.GetRepoRepository() # Clean up our root and sync down the latest changes that were # submitted. repo.BuildRootGitCleanup(self._build_root) # Sync down the latest changes we have submitted. if self._run.options.sync: next_manifest = self._run.config.manifest repo.Sync(next_manifest) # Commit uprev and portage cache regeneration locally. if self._run.options.uprev and self._run.config.uprev: commands.UprevPackages(self._build_root, self._boards, overlay_type=self._run.config.overlays) push_overlays = portage_util.FindOverlays( self._run.config.push_overlays, buildroot=self._build_root) commands.RegenPortageCache(push_overlays) # When prebuilts is True, if it's a successful run, update binhost conf. if self._run.config.prebuilts and self.success: confwriter = prebuilts.BinhostConfWriter(self._run) confwriter.Perform() # Push the uprev, portage cache, and binhost commits. commands.UprevPush(self._build_root, overlay_type=self._run.config.push_overlays, dryrun=self._run.options.debug) if config_lib.IsMasterAndroidPFQ(self._run.config) and self.success: self._run.attrs.metadata.UpdateWithDict({'UprevvedAndroid': True})
def testMasterPaladinExperimentalBuilders(self): """Tests that commands are not run for experimental builders.""" self._Prepare('master-paladin') confwriter = prebuilts.BinhostConfWriter(self._run) self._run.attrs.metadata.UpdateWithDict({ constants.METADATA_EXPERIMENTAL_BUILDERS: ['samus', 'daisy'] }) confwriter.Perform() # Provide a sample of private/public slave boards that are expected. public_slave_boards = ('amd64-generic',) private_slave_boards = ('cyan', 'daisy_spring') self._VerifyResults(public_slave_boards=public_slave_boards, private_slave_boards=private_slave_boards)
def PerformStage(self): overlays, push_overlays = self._ExtractOverlays() staging_branch = None if self.stage_push: if not config_lib.IsMasterChromePFQ(self._run.config): raise ValueError( 'This build must be a master chrome PFQ build ' 'when stage_push is True.') build_id, db = self._run.GetCIDBHandle() # If the master passed BinHostTest and all the important slaves passed # UploadPrebuiltsTest, push uprev commits to a staging_branch. if (self.CheckMasterBinhostTest(db, build_id) and self.CheckSlaveUploadPrebuiltsTest(db, build_id)): staging_branch = ('refs/' + constants.PFQ_REF + '/' + constants.STAGING_PFQ_BRANCH_PREFIX + str(build_id)) assert push_overlays, 'push_overlays must be set to run this stage' # If we're a commit queue, we should clean out our local changes, resync, # and reapply our uprevs. This is necessary so that 1) we are sure to point # at the remote SHA1s, not our local SHA1s; 2) we can avoid doing a # rebase; 3) in the case of failure and staging_branch is None, we don't # submit the changes that were committed locally. # # If we're not a commit queue and the build succeeded, we can skip the # cleanup here. This is a cheap trick so that the Chrome PFQ pushes its # earlier uprev from the SyncChrome stage (it would be a bit tricky to # replicate the uprev here, so we'll leave it alone). # If we're not a commit queue and staging_branch is not None, we can skip # the cleanup here. When staging_branch is not None, we're going to push # the local commits generated in AFDOUpdateEbuild stage to the # staging_branch, cleaning up repository here will wipe out the local # commits. if (config_lib.IsCQType(self._run.config.build_type) or not (self.success or staging_branch is not None)): # Clean up our root and sync down the latest changes that were # submitted. commands.BuildRootGitCleanup(self._build_root) # Sync down the latest changes we have submitted. if self._run.options.sync: next_manifest = self._run.config.manifest repo = self.GetRepoRepository() repo.Sync(next_manifest) # Commit an uprev locally. if self._run.options.uprev and self._run.config.uprev: commands.UprevPackages(self._build_root, self._boards, overlays) # When prebuilts is True, if it's a successful run or staging_branch is # not None for a master-chrome-pfq run, update binhost conf if (self._run.config.prebuilts and (self.success or staging_branch is not None)): confwriter = prebuilts.BinhostConfWriter(self._run) confwriter.Perform() # Push the uprev and binhost commits. commands.UprevPush(self._build_root, push_overlays, self._run.options.debug, staging_branch=staging_branch) if config_lib.IsMasterChromePFQ(self._run.config) and self.success: self._run.attrs.metadata.UpdateWithDict({'UprevvedChrome': True})
def PerformStage(self): if (config_lib.IsMasterCQ(self._run.config) and not self.sync_stage.pool.HasPickedUpCLs()): logging.info('No CLs have been picked up and no slaves have been ' 'scheduled in this run. Will not publish uprevs.') return # Either has to be a master or not have any push overlays. assert self._run.config.master assert self._run.config.push_overlays staging_branch = None if self.stage_push: if not config_lib.IsMasterChromePFQ(self._run.config): raise ValueError( 'This build must be a master chrome PFQ build ' 'when stage_push is True.') build_identifier, _ = self._run.GetCIDBHandle() buildbucket_id = build_identifier.buildbucket_id # If the master passed BinHostTest and all the important slaves passed # UploadPrebuiltsTest, push uprev commits to a staging_branch. if (self.CheckMasterBinhostTest(buildbucket_id) and self.CheckSlaveUploadPrebuiltsTest()): staging_branch = ('refs/' + constants.PFQ_REF + '/' + constants.STAGING_PFQ_BRANCH_PREFIX + str(buildbucket_id)) # If we're a commit queue, we should clean out our local changes, resync, # and reapply our uprevs. This is necessary so that 1) we are sure to point # at the remote SHA1s, not our local SHA1s; 2) we can avoid doing a # rebase; 3) in the case of failure and staging_branch is None, we don't # submit the changes that were committed locally. # # If we're not a commit queue and the build succeeded, we can skip the # cleanup here. This is a cheap trick so that the Chrome PFQ pushes its # earlier uprev from the SyncChrome stage (it would be a bit tricky to # replicate the uprev here, so we'll leave it alone). # If we're not a commit queue and staging_branch is not None, we can skip # the cleanup here. When staging_branch is not None, we're going to push # the local commits generated in AFDOUpdateEbuild stage to the # staging_branch, cleaning up repository here will wipe out the local # commits. if (config_lib.IsCQType(self._run.config.build_type) or not (self.success or staging_branch is not None)): repo = self.GetRepoRepository() # Clean up our root and sync down the latest changes that were # submitted. repo.BuildRootGitCleanup(self._build_root) # Sync down the latest changes we have submitted. if self._run.options.sync: next_manifest = self._run.config.manifest repo.Sync(next_manifest) # Commit uprev and portage cache regeneration locally. if self._run.options.uprev and self._run.config.uprev: commands.UprevPackages(self._build_root, self._boards, overlay_type=self._run.config.overlays) push_overlays = portage_util.FindOverlays( self._run.config.push_overlays, buildroot=self._build_root) commands.RegenPortageCache(push_overlays) # When prebuilts is True, if it's a successful run or staging_branch is # not None for a master-chrome-pfq run, update binhost conf if (self._run.config.prebuilts and (self.success or staging_branch is not None)): confwriter = prebuilts.BinhostConfWriter(self._run) confwriter.Perform() # Push the uprev, portage cache, and binhost commits. commands.UprevPush(self._build_root, overlay_type=self._run.config.push_overlays, dryrun=self._run.options.debug, staging_branch=staging_branch) if config_lib.IsMasterAndroidPFQ(self._run.config) and self.success: self._run.attrs.metadata.UpdateWithDict({'UprevvedAndroid': True})