build

package
v0.29.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SupportedPlatformAPIVersions lists the Platform API versions pack supports listed from earliest to latest
	SupportedPlatformAPIVersions = builder.APISet{
		api.MustParse("0.3"),
		api.MustParse("0.4"),
		api.MustParse("0.5"),
		api.MustParse("0.6"),
		api.MustParse("0.7"),
		api.MustParse("0.8"),
		api.MustParse("0.9"),
		api.MustParse("0.10"),
	}
)

Functions

func FindLatestSupported added in v0.29.0

func FindLatestSupported(builderapis []*api.Version, lifecycleapis []string) (*api.Version, error)

public for unit test purposes but cmon you probably don't want to actually call this.

Types

type Builder added in v0.10.0

type Builder interface {
	Name() string
	UID() int
	GID() int
	LifecycleDescriptor() builder.LifecycleDescriptor
	Stack() builder.StackMetadata
	Image() imgutil.Image
	OrderExtensions() dist.Order
}

type Cache

type Cache interface {
	Name() string
	Clear(context.Context) error
	Type() cache.Type
}

type ContainerOperation added in v0.12.0

type ContainerOperation func(ctrClient DockerClient, ctx context.Context, containerID string, stdout, stderr io.Writer) error

func CopyDir added in v0.12.0

func CopyDir(src, dst string, uid, gid int, os string, includeRoot bool, fileFilter func(string) bool) ContainerOperation

CopyDir copies a local directory (src) to the destination on the container while filtering files and changing it's UID/GID. if includeRoot is set the UID/GID will be set on the dst directory.

func CopyOut added in v0.23.0

func CopyOut(handler func(closer io.ReadCloser) error, srcs ...string) ContainerOperation

CopyOut copies container directories to a handler function. The handler is responsible for closing the Reader.

func CopyOutTo added in v0.24.0

func CopyOutTo(src, dest string) ContainerOperation

func EnsureVolumeAccess added in v0.14.0

func EnsureVolumeAccess(uid, gid int, os string, volumeNames ...string) ContainerOperation

EnsureVolumeAccess grants full access permissions to volumes for UID/GID-based user When UID/GID are 0 it grants explicit full access to BUILTIN\Administrators and any other UID/GID grants full access to BUILTIN\Users Changing permissions on volumes through stopped containers does not work on Docker for Windows so we start the container and make change using icacls See: https://github.com/moby/moby/issues/40771

func WriteProjectMetadata added in v0.21.0

func WriteProjectMetadata(p string, metadata platform.ProjectMetadata, os string) ContainerOperation

WriteProjectMetadata

func WriteStackToml added in v0.12.0

func WriteStackToml(dstPath string, stack builder.StackMetadata, os string) ContainerOperation

WriteStackToml writes a `stack.toml` based on the StackMetadata provided to the destination path.

type DefaultPhaseFactory added in v0.10.0

type DefaultPhaseFactory struct {
	// contains filtered or unexported fields
}

func (*DefaultPhaseFactory) New added in v0.10.0

type DockerClient added in v0.29.0

type DockerClient interface {
	ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
	VolumeRemove(ctx context.Context, volumeID string, force bool) error
	ContainerWait(ctx context.Context, container string, condition containertypes.WaitCondition) (<-chan containertypes.ContainerWaitOKBody, <-chan error)
	ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
	ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
	ContainerCreate(ctx context.Context, config *containertypes.Config, hostConfig *containertypes.HostConfig, networkingConfig *networktypes.NetworkingConfig, platform *specs.Platform, containerName string) (containertypes.ContainerCreateCreatedBody, error)
	CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
	ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
	ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error
	CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error
}

type LifecycleExecution added in v0.13.0

type LifecycleExecution struct {
	// contains filtered or unexported fields
}

func NewLifecycleExecution added in v0.13.0

func NewLifecycleExecution(logger logging.Logger, docker DockerClient, opts LifecycleOptions) (*LifecycleExecution, error)

func (*LifecycleExecution) Analyze added in v0.13.0

func (l *LifecycleExecution) Analyze(ctx context.Context, buildCache, launchCache Cache, phaseFactory PhaseFactory) error

func (LifecycleExecution) AppDir added in v0.19.0

func (l LifecycleExecution) AppDir() string

func (*LifecycleExecution) AppPath added in v0.13.0

func (l *LifecycleExecution) AppPath() string

func (*LifecycleExecution) AppVolume added in v0.13.0

func (l *LifecycleExecution) AppVolume() string

func (*LifecycleExecution) Build added in v0.13.0

func (l *LifecycleExecution) Build(ctx context.Context, phaseFactory PhaseFactory) error

func (*LifecycleExecution) Builder added in v0.13.0

func (l *LifecycleExecution) Builder() Builder

func (*LifecycleExecution) Cleanup added in v0.13.0

func (l *LifecycleExecution) Cleanup() error

func (*LifecycleExecution) Create added in v0.13.0

func (l *LifecycleExecution) Create(ctx context.Context, buildCache, launchCache Cache, phaseFactory PhaseFactory) error

func (*LifecycleExecution) Detect added in v0.13.0

func (l *LifecycleExecution) Detect(ctx context.Context, phaseFactory PhaseFactory) error

func (*LifecycleExecution) Export added in v0.13.0

func (l *LifecycleExecution) Export(ctx context.Context, buildCache, launchCache Cache, phaseFactory PhaseFactory) error

func (*LifecycleExecution) Extend added in v0.28.0

func (l *LifecycleExecution) Extend(ctx context.Context, buildCache Cache, phaseFactory PhaseFactory) error

func (*LifecycleExecution) ImageName added in v0.22.0

func (l *LifecycleExecution) ImageName() name.Reference

func (*LifecycleExecution) LayersVolume added in v0.13.0

func (l *LifecycleExecution) LayersVolume() string

func (*LifecycleExecution) PlatformAPI added in v0.13.0

func (l *LifecycleExecution) PlatformAPI() *api.Version

func (*LifecycleExecution) PrevImageName added in v0.22.0

func (l *LifecycleExecution) PrevImageName() string

func (*LifecycleExecution) Restore added in v0.13.0

func (l *LifecycleExecution) Restore(ctx context.Context, buildCache Cache, phaseFactory PhaseFactory) error

func (*LifecycleExecution) Run added in v0.13.0

func (l *LifecycleExecution) Run(ctx context.Context, phaseFactoryCreator PhaseFactoryCreator) error

type LifecycleExecutor added in v0.13.0

type LifecycleExecutor struct {
	// contains filtered or unexported fields
}

func NewLifecycleExecutor added in v0.13.0

func NewLifecycleExecutor(logger logging.Logger, docker DockerClient) *LifecycleExecutor

func (*LifecycleExecutor) Execute added in v0.13.0

func (l *LifecycleExecutor) Execute(ctx context.Context, opts LifecycleOptions) error

type LifecycleOptions

type LifecycleOptions struct {
	AppPath              string
	Image                name.Reference
	Builder              Builder
	BuilderImage         string // differs from Builder.Name() and Builder.Image().Name() in that it includes the registry context
	LifecycleImage       string
	LifecycleApis        []string // optional - populated only if custom lifecycle image is downloaded, from that lifecycle's container's Labels.
	RunImage             string
	ProjectMetadata      platform.ProjectMetadata
	ClearCache           bool
	Publish              bool
	TrustBuilder         bool
	UseCreator           bool
	Interactive          bool
	Termui               Termui
	DockerHost           string
	Cache                cache.CacheOpts
	CacheImage           string
	HTTPProxy            string
	HTTPSProxy           string
	NoProxy              string
	Network              string
	AdditionalTags       []string
	Volumes              []string
	DefaultProcessType   string
	FileFilter           func(string) bool
	Workspace            string
	GID                  int
	PreviousImage        string
	ReportDestinationDir string
	SBOMDestinationDir   string
	CreationTime         *time.Time
}

type Phase

type Phase struct {
	// contains filtered or unexported fields
}

func (*Phase) Cleanup

func (p *Phase) Cleanup() error

func (*Phase) Run

func (p *Phase) Run(ctx context.Context) error

type PhaseConfigProvider added in v0.10.0

type PhaseConfigProvider struct {
	// contains filtered or unexported fields
}

func NewPhaseConfigProvider added in v0.10.0

func NewPhaseConfigProvider(name string, lifecycleExec *LifecycleExecution, ops ...PhaseConfigProviderOperation) *PhaseConfigProvider

func (*PhaseConfigProvider) ContainerConfig added in v0.10.0

func (p *PhaseConfigProvider) ContainerConfig() *container.Config

func (*PhaseConfigProvider) ContainerOps added in v0.12.0

func (p *PhaseConfigProvider) ContainerOps() []ContainerOperation

func (*PhaseConfigProvider) ErrorWriter added in v0.11.0

func (p *PhaseConfigProvider) ErrorWriter() io.Writer

func (*PhaseConfigProvider) Handler added in v0.21.0

func (p *PhaseConfigProvider) Handler() pcontainer.Handler

func (*PhaseConfigProvider) HostConfig added in v0.10.0

func (p *PhaseConfigProvider) HostConfig() *container.HostConfig

func (*PhaseConfigProvider) InfoWriter added in v0.11.0

func (p *PhaseConfigProvider) InfoWriter() io.Writer

func (*PhaseConfigProvider) Name added in v0.10.0

func (p *PhaseConfigProvider) Name() string

func (*PhaseConfigProvider) PostContainerRunOps added in v0.23.0

func (p *PhaseConfigProvider) PostContainerRunOps() []ContainerOperation

type PhaseConfigProviderOperation added in v0.10.0

type PhaseConfigProviderOperation func(*PhaseConfigProvider)

func If added in v0.23.0

func NullOp added in v0.16.0

func WithArgs

func WithArgs(args ...string) PhaseConfigProviderOperation

func WithBinds

func WithBinds(binds ...string) PhaseConfigProviderOperation

func WithContainerOperations added in v0.12.0

func WithContainerOperations(operations ...ContainerOperation) PhaseConfigProviderOperation

func WithDaemonAccess

func WithDaemonAccess(dockerHost string) PhaseConfigProviderOperation

func WithEnv added in v0.11.0

func WithEnv(envs ...string) PhaseConfigProviderOperation

func WithFlags added in v0.12.0

func WithFlags(flags ...string) PhaseConfigProviderOperation

WithFlags differs from WithArgs as flags are always prepended

func WithImage added in v0.11.0

func WithImage(image string) PhaseConfigProviderOperation

func WithLifecycleProxy added in v0.10.0

func WithLifecycleProxy(lifecycleExec *LifecycleExecution) PhaseConfigProviderOperation

func WithLogPrefix added in v0.11.0

func WithLogPrefix(prefix string) PhaseConfigProviderOperation

WithLogPrefix sets a prefix for logs produced by this phase

func WithNetwork

func WithNetwork(networkMode string) PhaseConfigProviderOperation

func WithPostContainerRunOperations added in v0.23.0

func WithPostContainerRunOperations(operations ...ContainerOperation) PhaseConfigProviderOperation

func WithRegistryAccess

func WithRegistryAccess(authConfig string) PhaseConfigProviderOperation

type PhaseFactory added in v0.10.0

type PhaseFactory interface {
	New(provider *PhaseConfigProvider) RunnerCleaner
}

func NewDefaultPhaseFactory added in v0.10.0

func NewDefaultPhaseFactory(lifecycleExec *LifecycleExecution) PhaseFactory

type PhaseFactoryCreator added in v0.14.0

type PhaseFactoryCreator func(*LifecycleExecution) PhaseFactory

type RunnerCleaner added in v0.10.0

type RunnerCleaner interface {
	Run(ctx context.Context) error
	Cleanup() error
}

type Termui added in v0.21.0

type Termui interface {
	logging.Logger

	Run(funk func()) error
	Handler() container.Handler
	ReadLayers(reader io.ReadCloser) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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