Exemplo n.º 1
0
def main(cli_args):
    builder_args = node_parser.parse_args(cli_args)
    logger.setup_logging(builder_args)
    with ftl_util.Timing("full build"):
        with ftl_util.Timing("builder initialization"):
            node_ftl = node_builder.Node(
                context.Workspace(builder_args.directory), builder_args,
                _NODE_CACHE_VERSION)
        with ftl_util.Timing("build process for FTL image"):
            node_ftl.Build()
Exemplo n.º 2
0
def main(cli_args):
    try:
        builder_args = node_parser.parse_args(cli_args)
        logger.setup_logging(builder_args)
        logger.preamble("node", builder_args)
        with ftl_util.Timing("full build"):
            with ftl_util.Timing("builder initialization"):
                node_ftl = node_builder.Node(
                    context.Workspace(builder_args.directory), builder_args)
            with ftl_util.Timing("build process for FTL image"):
                node_ftl.Build()
    except ftl_error.UserError as e:
        ftl_error.UserErrorHandler(e, builder_args.builder_output_path)
    except ftl_error.InternalError as e:
        ftl_error.InternalErrorHandler(e, builder_args.builder_output_path)
Exemplo n.º 3
0
    def setUp(self, mock_from):
        mock_from.return_value.__enter__.return_value = None
        self._tmpdir = tempfile.mkdtemp()
        self.ctx = context.Memory()
        self.ctx.AddFile("app.js", _APP)
        args = mock.Mock()
        args.name = 'gcr.io/test/test:latest'
        args.base = 'gcr.io/google-appengine/python:latest'
        args.tar_base_image_path = None
        self.builder = builder.Node(self.ctx, args)
        self.layer_builder = layer_builder.LayerBuilder(
            ctx=self.builder._ctx,
            descriptor_files=self.builder._descriptor_files,
            destination_path="/app")

        # Mock out the calls to package managers for speed.
        self.layer_builder._gen_npm_install_tar = mock.Mock()
        self.layer_builder._gen_npm_install_tar.return_value = ('layer', 'sha')