// Build builds an application image according to the provided parameters.
Build builds an application image according to the provided parameters.
// Build builds an application image according to the provided parameters .
func (b *applicationBuilder) Build(ctx context.Context, req ApplicationRequest) error {
	chart, err := loader.Load(req.ChartPath)
	if err != nil {
		return trace.Wrap(err)
	}
	manifest, err := generateApplicationImageManifest(chart)
	if err != nil {
		return trace.Wrap(err)
	}
	outputPath, err := checkOutputPath(manifest, req.OutputPath, req.Overwrite)
	if err != nil {
		return trace.Wrap(err)
	}
	locator := imageLocator(manifest, req.Vendor)
	b.NextStep("Building application image %v %v from Helm chart", locator.Name,
		locator.Version)
	vendorDir, err := ioutil.TempDir("", "vendor")
	if err != nil {
		return trace.Wrap(err)
	}
	defer os.RemoveAll(vendorDir)
	b.NextStep("Discovering and embedding Docker images")
	stream, err := b.Vendor(ctx, VendorRequest{
		SourceDir: req.ChartPath,
		VendorDir: vendorDir,
		Manifest:  manifest,
		Vendor:    req.Vendor,
	})
	if err != nil {
		return trace.Wrap(err)
	}
	defer stream.Close()
	b.NextStep("Creating application")
	application, err := b.CreateApplication(stream)
	if err != nil {
		return trace.Wrap(err)
	}
	b.NextStep("Packaging application image")
	installer, err := b.GenerateInstaller(manifest, *application)
	if err != nil {
		return trace.Wrap(err)
	}
	defer installer.Close()
	b.NextStep("Saving application image to %v", outputPath)
	err = b.WriteInstaller(installer, outputPath)
	if err != nil {
		return trace.Wrap(err)
	}
	return nil
}
func ( b * applicationBuilder ) Build ( ctx context . Context , req ApplicationRequest ) error { chart , err := loader . Load ( req . ChartPath ) if err != nil { return trace . Wrap ( err ) } manifest , err := generateApplicationImageManifest ( chart ) if err != nil { return trace . Wrap ( err ) } outputPath , err := checkOutputPath ( manifest , req . OutputPath , req . Overwrite ) if err != nil { return trace . Wrap ( err ) } locator := imageLocator ( manifest , req . Vendor ) b . NextStep ( " " , locator . Name , locator . Version ) vendorDir , err := ioutil . TempDir ( " " , " " ) if err != nil { return trace . Wrap ( err ) } defer os . RemoveAll ( vendorDir ) b . NextStep ( " " ) stream , err := b . Vendor ( ctx , VendorRequest { SourceDir : req . ChartPath , VendorDir : vendorDir , Manifest : manifest , Vendor : req . Vendor , } ) if err != nil { return trace . Wrap ( err ) } defer stream . Close ( ) b . NextStep ( " " ) application , err := b . CreateApplication ( stream ) if err != nil { return trace . Wrap ( err ) } b . NextStep ( " " ) installer , err := b . GenerateInstaller ( manifest , * application ) if err != nil { return trace . Wrap ( err ) } defer installer . Close ( ) b . NextStep ( " " , outputPath ) err = b . WriteInstaller ( installer , outputPath ) if err != nil { return trace . Wrap ( err ) } return nil }
Build builds an application image according to the provided parameters.
Build builds an application image according to the provided parameters .