builder

package
v0.0.0-...-0755659 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2019 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(ctx context.Context, builder *Builder) error

Build builds the standalone application installer using the provided builder

func NewPackSyncer

func NewPackSyncer(pack pack.PackageService, apps app.Applications, repo string) *packSyncer

NewPackSyncer creates a new syncer from provided pack and apps services

Types

type Builder

type Builder struct {
	// Config is the builder configuration
	Config
	// Env is the local build environment
	Env *localenv.LocalEnvironment
	// Manifest is the parsed manifest of the application being built
	Manifest schema.Manifest
	// Dir is the directory where build-related data is stored
	Dir string
	// Backend is the local backend
	Backend storage.Backend
	// Packages is the layered package service with the local cache
	// directory serving as a 'read' layer and the temporary directory
	// as a 'read-write' layer
	Packages pack.PackageService
	// Apps is the application service based on the layered package service
	Apps app.Applications
	// contains filtered or unexported fields
}

Builder implements the installer builder

func New

func New(config Config) (*Builder, error)

New creates a new builder instance from the provided config

func (*Builder) Close

func (b *Builder) Close() error

Close cleans up build environment

func (*Builder) CreateApplication

func (b *Builder) CreateApplication(data io.ReadCloser) (*app.Application, error)

CreateApplication creates a Gravity application from the provided data in the local database

func (*Builder) GenerateInstaller

func (b *Builder) GenerateInstaller(application app.Application) (io.ReadCloser, error)

GenerateInstaller generates an installer tarball for the specified application and returns its data as a stream

func (*Builder) Locator

func (b *Builder) Locator() loc.Locator

Locator returns locator of the application that's being built

func (*Builder) SelectRuntime

func (b *Builder) SelectRuntime() (*semver.Version, error)

SelectRuntime picks an appropriate runtime for the application that's being built

func (*Builder) SyncPackageCache

func (b *Builder) SyncPackageCache(runtimeVersion *semver.Version) error

SyncPackageCache ensures that all system dependencies are present in the local cache directory

func (*Builder) Vendor

func (b *Builder) Vendor(ctx context.Context, dir string) (io.ReadCloser, error)

Vendor vendors the application images in the provided directory and returns the compressed data stream with the application data

func (*Builder) WriteInstaller

func (b *Builder) WriteInstaller(data io.ReadCloser) error

WriteInstaller writes the provided installer tarball data to disk

type Config

type Config struct {
	// Context is the build context
	Context context.Context
	// StateDir is the configured builder state directory
	StateDir string
	// Insecure disables client verification of the server TLS certificate chain
	Insecure bool
	// ManifestPath holds the path to the application manifest
	ManifestPath string

	// OutPath holds the path to the installer tarball to be output
	OutPath string
	// Overwrite indicates whether or not to overwrite an existing installer file
	Overwrite bool
	// Repository represents the source package repository
	Repository string
	// SkipVersionCheck allows to skip tele/runtime compatibility check
	SkipVersionCheck bool
	// VendorReq combines vendoring options
	VendorReq service.VendorRequest
	// Generator is used to generate installer
	Generator Generator
	// NewSyncer is used to initialize package cache syncer for the builder
	NewSyncer NewSyncerFunc
	// GetRepository is a function that returns package source repository
	GetRepository GetRepositoryFunc
	// FieldLogger is used for logging
	logrus.FieldLogger
	// Progress allows builder to report build progress
	utils.Progress
	// Silent suppresses all std output when set to true
	Silent bool
	// contains filtered or unexported fields
}

Config is the builder configuration

func (*Config) CheckAndSetDefaults

func (c *Config) CheckAndSetDefaults() error

CheckAndSetDefaults validates builder config and fills in defaults

type Generator

type Generator interface {
	// Generate generates an installer tarball for the specified application
	// using the provided builder and returns its data as a stream
	Generate(*Builder, app.Application) (io.ReadCloser, error)
}

Generator defines a method for generating standalone installers

type GetRepositoryFunc

type GetRepositoryFunc func(*Builder) (string, error)

GetRepositoryFunc defines function that returns package source repository

type NewSyncerFunc

type NewSyncerFunc func(*Builder) (Syncer, error)

NewSyncerFunc defines function that creates syncer for a builder

type Syncer

type Syncer interface {
	// Sync makes sure that local cache has all required dependencies for the
	// selected runtime
	Sync(*Builder, *semver.Version) error
	// SelectRuntime picks an appropriate runtime for the application that's
	// being built
	SelectRuntime(*Builder) (*semver.Version, error)
}

Syncer synchronizes the local package cache from a (remote) repository

func NewSyncer

func NewSyncer(b *Builder) (Syncer, error)

NewSyncer returns a new syncer instance for the provided builder

Satisfies NewSyncerFunc type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL