def _ShouldGenerateBlameListSinceLKGM(self): """Returns True if we should generate the blamelist.""" # We want to generate the blamelist only for valid pfq types and if we are # building on the master branch i.e. revving the build number. return (self.incr_type == 'build' and cbuildbot_config.IsPFQType(self.build_type) and self.build_type != constants.CHROME_PFQ_TYPE)
def __init__(self, source_repo, manifest_repo, build_name, build_type, incr_type, force, branch, manifest=constants.DEFAULT_MANIFEST, dry_run=True, master=False): """Initialize an LKGM Manager. Args: build_type: Type of build. Must be a pfq type. Other args see manifest_version.BuildSpecsManager. """ super(LKGMManager, self).__init__( source_repo=source_repo, manifest_repo=manifest_repo, manifest=manifest, build_name=build_name, incr_type=incr_type, force=force, branch=branch, dry_run=dry_run, master=master) self.lkgm_path = os.path.join(self.manifest_dir, self.LKGM_PATH) self.compare_versions_fn = _LKGMCandidateInfo.VersionCompare self.build_type = build_type # Chrome PFQ and PFQ's exist at the same time and version separately so they # must have separate subdirs in the manifest-versions repository. if self.build_type == constants.CHROME_PFQ_TYPE: self.rel_working_dir = self.CHROME_PFQ_SUBDIR elif cbuildbot_config.IsCQType(self.build_type): self.rel_working_dir = self.COMMIT_QUEUE_SUBDIR else: assert cbuildbot_config.IsPFQType(self.build_type) self.rel_working_dir = self.LKGM_SUBDIR
def testChromeRev(self): """Verify chrome_rev has an expected value""" for build_name, config in cbuildbot_config.config.iteritems(): self.assertTrue( config['chrome_rev'] in constants.VALID_CHROME_REVISIONS + [None], 'Config %s: has unexpected chrome_rev value.' % build_name) self.assertFalse( config['chrome_rev'] == constants.CHROME_REV_LOCAL, 'Config %s: has unexpected chrome_rev_local value.' % build_name) if config['chrome_rev']: self.assertTrue( cbuildbot_config.IsPFQType(config['build_type']), 'Config %s: has chrome_rev but is not a PFQ.' % build_name)
def CreateNewCandidate(self, validation_pool=None, retries=manifest_version.NUM_RETRIES): """Creates, syncs to, and returns the next candidate manifest. Args: validation_pool: Validation pool to apply to the manifest before publishing. retries: Number of retries for updating the status. Raises: GenerateBuildSpecException in case of failure to generate a buildspec """ self.CheckoutSourceCode() # Refresh manifest logic from manifest_versions repository to grab the # LKGM to generate the blamelist. version_info = self.GetCurrentVersionInfo() self.RefreshManifestCheckout() self.InitializeManifestVariables(version_info) self._GenerateBlameListSinceLKGM() new_manifest = self.CreateManifest() # For the Commit Queue, apply the validation pool as part of checkout. if validation_pool: # If we have nothing that could apply from the validation pool and # we're not also a pfq type, we got nothing to do. assert self.cros_source.directory == validation_pool.build_root if (not validation_pool.ApplyPoolIntoRepo() and not cbuildbot_config.IsPFQType(self.build_type)): return None self._AddPatchesToManifest(new_manifest, validation_pool.changes) last_error = None for attempt in range(0, retries + 1): try: # Refresh manifest logic from manifest_versions repository. # Note we don't need to do this on our first attempt as we needed to # have done it to get the LKGM. if attempt != 0: self.RefreshManifestCheckout() self.InitializeManifestVariables(version_info) # If we don't have any valid changes to test, make sure the checkout # is at least different. if ((not validation_pool or not validation_pool.changes) and not self.force and self.HasCheckoutBeenBuilt()): return None # Check whether the latest spec available in manifest-versions is # newer than our current version number. If so, use it as the base # version number. Otherwise, we default to 'rc1'. if self.latest: latest = max(self.latest, version_info.VersionString(), key=self.compare_versions_fn) version_info = _LKGMCandidateInfo( latest, chrome_branch=version_info.chrome_branch, incr_type=self.incr_type) git.CreatePushBranch(manifest_version.PUSH_BRANCH, self.manifest_dir, sync=False) version = self.GetNextVersion(version_info) self.PublishManifest(new_manifest, version) self.current_version = version return self.GetLocalManifest(version) except cros_build_lib.RunCommandError as e: err_msg = 'Failed to generate LKGM Candidate. error: %s' % e logging.error(err_msg) last_error = err_msg else: raise manifest_version.GenerateBuildSpecException(last_error)