Esempio n. 1
0
  def PerformStage(self):
    self.Initialize()

    self._VerifyMasterId(self._run.options.master_buildbucket_id)
    version = self._run.options.force_version
    if self._run.options.master_buildbucket_id:
      version = self._GetMasterVersion(self._run.options.master_buildbucket_id)

    next_manifest = None
    if version:
      next_manifest = self.ForceVersion(version)
    else:
      self.skip_sync = True
      next_manifest = self.GetNextManifest()

    if not next_manifest:
      logging.info('Found no work to do.')
      if self._run.attrs.manifest_manager.DidLastBuildFail():
        raise failures_lib.StepFailure('The previous build failed.')
      else:
        raise failures_lib.ExitEarlyException(
            'ManifestVersionedSyncStage finished and exited early.')

    # Log this early on for the release team to grep out before we finish.
    if self.manifest_manager:
      self._Print(
          '\nRELEASETAG: %s\n' % (self.manifest_manager.current_version))

    self._SetAndroidVersionIfApplicable(next_manifest)
    self._SetChromeVersionIfApplicable(next_manifest)
    # To keep local trybots working, remove restricted checkouts from the
    # official manifest we get from manifest-versions.
    with self.LocalizeManifest(
        next_manifest, filter_cros=self._run.options.local) as new_manifest:
      self.ManifestCheckout(new_manifest)
Esempio n. 2
0
    def PerformStage(self):
        # This stage runs only in builders where |android_rev| config is set,
        # namely Android PFQ and pre-flight-branch builders.
        if not self._android_rev:
            logging.info('Not uprevving Android.')
            return

        android_package = self._run.config.android_package
        android_build_branch = self._run.config.android_import_branch
        android_version = _GetAndroidVersionFromMetadata(
            self._run.attrs.metadata)
        android_gts_build_branch = self._run.config.android_gts_build_branch

        assert android_package
        assert android_build_branch
        # |android_version| is usually set by MasterSlaveLKGMSyncStage, but we allow
        # it to be unset to indicate uprev'ing to the latest version. In fact, it is
        # not set in trybots.
        # |android_gts_build_branch| is not set if this builder is not supposed to
        # upload GTS bundles.

        logging.info('Android package: %s', android_package)
        logging.info('Android branch: %s', android_build_branch)
        logging.info('Android version: %s', android_version or 'LATEST')
        logging.info('Android GTS branch: %s', android_gts_build_branch
                     or 'N/A')

        try:
            android_atom_to_build = commands.MarkAndroidAsStable(
                buildroot=self._build_root,
                tracking_branch=self._run.manifest_branch,
                android_package=android_package,
                android_build_branch=android_build_branch,
                boards=self._boards,
                android_version=android_version,
                android_gts_build_branch=android_gts_build_branch)
        except commands.AndroidIsPinnedUprevError as e:
            # If uprev failed due to a pin, record that failure (so that the
            # build ultimately fails) but try again without the pin, to allow the
            # slave to test the newer version anyway).
            android_atom_to_build = e.new_android_atom
            results_lib.Results.Record(self.name, e)
            logging.PrintBuildbotStepFailure()
            logging.error(
                'Android is pinned. Unpinning Android and continuing '
                'build for Android atom %s. This stage will be marked '
                'as failed to prevent an uprev.', android_atom_to_build)
            logging.info('Deleting pin file at %s and proceeding.',
                         ANDROIDPIN_MASK_PATH)
            osutils.SafeUnlink(ANDROIDPIN_MASK_PATH)

        logging.info('New Android package atom: %s', android_atom_to_build)

        if (not android_atom_to_build and self._run.options.buildbot
                and self._run.config.build_type == constants.ANDROID_PFQ_TYPE):
            logging.info('Android already uprevved. Nothing else to do.')
            raise failures_lib.ExitEarlyException(
                'UprevAndroidStage finished and exited early.')
Esempio n. 3
0
  def PerformStage(self):
    chrome_atom_to_build = None
    if self._chrome_rev:
      if (self._chrome_rev == constants.CHROME_REV_SPEC and
          self._run.options.chrome_version):
        self.chrome_version = self._run.options.chrome_version
        logging.info('Using chrome version from options.chrome_version: %s',
                     self.chrome_version)
      else:
        self.chrome_version = self._GetChromeVersionFromMetadata()
        if self.chrome_version:
          logging.info('Using chrome version from the metadata dictionary: %s',
                       self.chrome_version)

      # Perform chrome uprev.
      try:
        chrome_atom_to_build = commands.MarkChromeAsStable(
            self._build_root, self._run.manifest_branch,
            self._chrome_rev, self._boards,
            chrome_version=self.chrome_version)
      except commands.ChromeIsPinnedUprevError as e:
        # If uprev failed due to a chrome pin, record that failure (so that the
        # build ultimately fails) but try again without the pin, to allow the
        # slave to test the newer chrome anyway).
        chrome_atom_to_build = e.new_chrome_atom
        if chrome_atom_to_build:
          results_lib.Results.Record(self.name, e)
          logging.PrintBuildbotStepFailure()
          logging.error('Chrome is pinned. Attempting to continue build for '
                        'chrome atom %s anyway but build will ultimately fail.',
                        chrome_atom_to_build)
          logging.info('Deleting pin file at %s and proceeding.',
                       CHROMEPIN_MASK_PATH)
          osutils.SafeUnlink(CHROMEPIN_MASK_PATH)
        else:
          raise

    kwargs = {}
    if self._chrome_rev == constants.CHROME_REV_SPEC:
      kwargs['revision'] = self.chrome_version
      logging.PrintBuildbotStepText('revision %s' % kwargs['revision'])
    else:
      if not self.chrome_version:
        self.chrome_version = self._run.DetermineChromeVersion()

      kwargs['tag'] = self.chrome_version
      logging.PrintBuildbotStepText('tag %s' % kwargs['tag'])

    useflags = self._run.config.useflags
    commands.SyncChrome(self._build_root, self._run.options.chrome_root,
                        useflags, **kwargs)
    if (self._chrome_rev and not chrome_atom_to_build and
        self._run.options.buildbot and
        self._run.config.build_type == constants.CHROME_PFQ_TYPE):
      logging.info('Chrome already uprevved. Nothing else to do.')
      raise failures_lib.ExitEarlyException(
          'SyncChromeStage finished and exited early.')
Esempio n. 4
0
    def PerformStage(self):
        android_atom_to_build = None
        if self._android_rev:
            self.android_version = self._GetAndroidVersionFromMetadata()
            if self.android_version:
                logging.info(
                    'Using Android version from the metadata dictionary: %s',
                    self.android_version)

            try:
                android_atom_to_build = commands.MarkAndroidAsStable(
                    self._build_root,
                    self._run.manifest_branch,
                    self._boards,
                    android_version=self.android_version)
            except commands.AndroidIsPinnedUprevError as e:
                # If uprev failed due to a pin, record that failure (so that the
                # build ultimately fails) but try again without the pin, to allow the
                # slave to test the newer version anyway).
                android_atom_to_build = e.new_android_atom
                if android_atom_to_build:
                    results_lib.Results.Record(self.name, e)
                    logging.PrintBuildbotStepFailure()
                    logging.error(
                        'Android is pinned. Attempting to continue build for '
                        'Android atom %s anyway but build will ultimately '
                        'fail.', android_atom_to_build)
                    logging.info('Deleting pin file at %s and proceeding.',
                                 ANDROIDPIN_MASK_PATH)
                    osutils.SafeUnlink(ANDROIDPIN_MASK_PATH)
                else:
                    raise

        if (self._android_rev and not android_atom_to_build
                and self._run.options.buildbot
                and self._run.config.build_type == constants.ANDROID_PFQ_TYPE):
            logging.info('Android already uprevved. Nothing else to do.')
            raise failures_lib.ExitEarlyException(
                'UprevAndroidStage finished and exited early.')