Beispiel #1
0
def GenerateHtmlIndex(files, index, board, version, remote_location):
  """Given the list of |files|, generate an index.html at |index|.

  Args:
    files: The list of files to link to.
    index: The path to the html index.
    board: Name of the board this index is for.
    version: Build version this index is for.
    remote_location: Remote gs location prebuilts are uploaded to.
  """
  title = 'Package Prebuilt Index: %s / %s' % (board, version)

  files = files + [
      '.|Google Storage Index',
      '..|',
  ]
  commands.GenerateHtmlIndex(index, files, title=title,
                             url_base=gs.GsUrlToHttp(remote_location))
    def PerformStage(self):
        """Archive and publish the firmware build artifacts."""
        logging.info('Firmware board: %s', self._current_board)
        logging.info('Firmware version: %s', self.dummy_version)
        logging.info('Archive build as: %s', self.dummy_config)

        # Link dummy build artifacts from build.
        dummy_http_url = gs.GsUrlToHttp(self.dummy_archive_url,
                                        public=False,
                                        directory=True)

        label = '%s firmware [%s]' % (self._current_board, self.dummy_version)
        logging.PrintBuildbotLink(label, dummy_http_url)

        # Upload all artifacts.
        self.CreateFirmwareArchive()
        self.CreateDummyMetadataJson()
        self.PushBoardImage()
    def PerformStage(self):
        """Archive and publish the factory build artifacts."""
        logging.info('Factory version: %s', self.dummy_version)
        logging.info('Archive build as: %s', self.dummy_config)

        # Link dummy build artifacts from build.
        dummy_http_url = gs.GsUrlToHttp(self.dummy_archive_url,
                                        public=False,
                                        directory=True)

        label = '%s factory [%s]' % (self._current_board, self.dummy_version)
        logging.PrintBuildbotLink(label, dummy_http_url)

        # factory_image.zip
        self.CreateFactoryZip()
        self.CreateTestImageTar()
        self.CreateDummyMetadataJson()
        self.PushBoardImage()
Beispiel #4
0
    def _LinkArtifacts(self, builder_run):
        """Upload an HTML index and uploaded.json for artifacts.

    If there are no artifacts in the archive then do nothing.

    Args:
      builder_run: BuilderRun object for this run.
    """
        archive = builder_run.GetArchive()
        archive_path = archive.archive_path

        boards = builder_run.config.boards
        if boards:
            board_names = ' '.join(boards)
        else:
            boards = [None]
            board_names = '<no board>'

        # See if there are any artifacts found for this run.
        uploaded = os.path.join(archive_path, commands.UPLOADED_LIST_FILENAME)
        if not os.path.exists(uploaded):
            # UPLOADED doesn't exist.  Normal if Archive stage never ran, which
            # is possibly normal.  Regardless, no archive index is needed.
            logging.info('No archived artifacts found for %s run (%s)',
                         builder_run.config.name, board_names)
            return

        logging.PrintKitchenSetBuildProperty('artifact_link',
                                             archive.upload_url)

        uploaded_json = 'uploaded.json'
        commands.GenerateUploadJSON(os.path.join(archive_path, uploaded_json),
                                    archive_path, uploaded)
        commands.UploadArchivedFile(archive_path, [archive.upload_url],
                                    uploaded_json,
                                    debug=self._run.options.debug_forced,
                                    update_list=True,
                                    acl=self.acl)

        if builder_run.config.internal:
            # Internal builds simply link to pantheon directories, which require
            # authenticated access that most Googlers should have.
            artifacts_url = archive.download_url

        else:
            # External builds must allow unauthenticated access to build artifacts.
            # GS doesn't let unauthenticated users browse selected locations without
            # being able to browse everything (which would expose secret stuff).
            # So, we upload an index.html file and link to it instead of the
            # directory.
            title = 'Artifacts Index: %(board)s / %(version)s (%(config)s config)' % {
                'board': board_names,
                'config': builder_run.config.name,
                'version': builder_run.GetVersion(),
            }

            files = osutils.ReadFile(uploaded).splitlines() + [
                '.|Google Storage Index',
                '..|',
            ]

            index = os.path.join(archive_path, 'index.html')

            # TODO (sbasi) crbug.com/362776: Rework the way we do uploading to
            # multiple buckets. Currently this can only be done in the Archive Stage
            # therefore index.html will only end up in the normal Chrome OS bucket.
            commands.GenerateHtmlIndex(index,
                                       files,
                                       title=title,
                                       url_base=gs.GsUrlToHttp(
                                           archive.upload_url))
            commands.UploadArchivedFile(archive_path, [archive.upload_url],
                                        os.path.basename(index),
                                        debug=self._run.options.debug_forced,
                                        acl=self.acl)

            artifacts_url = os.path.join(archive.download_url_file,
                                         'index.html')

        links_build_description = '%s/%s' % (builder_run.config.name,
                                             archive.version)
        logging.PrintBuildbotLink('Artifacts[%s]' % links_build_description,
                                  artifacts_url)