build

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2018 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Label for all image builds created with Tilt.
	//
	// It's the responsibility of ImageBuilder to ensure
	// that all images built with Tilt have an appropriate BuildMode label.
	BuildMode dockerfile.Label = "tilt.buildMode"

	// Label when an image is created by a test.
	TestImage = "tilt.test"

	// Label when an image is for path caching.
	CacheImage = "tilt.cache"
)
View Source
const (
	BuildModeScratch  dockerfile.LabelValue = "scratch"
	BuildModeExisting                       = "existing"
)
View Source
const CacheTagPrefix = "tilt-cache-"

Cache directories are stored at the same image name, but with just the cachedir contents and at a particular tag.

Variables

View Source
var ImageTagPrefix = "tilt-"

The image tag prefix can be customized.

This allows our integration tests to customize the prefix so that they can write to a public registry without interfering with each other.

Functions

func BoilSteps

func BoilSteps(steps []model.Step, pathMappings []pathMapping) ([]model.Cmd, error)

func DefaultConsole

func DefaultConsole() console.Console

func DefaultOut

func DefaultOut() io.Writer

func FileBelongsToMount

func FileBelongsToMount(file string, mounts []model.Mount) bool

func FilesToPathMappings

func FilesToPathMappings(files []string, mounts []model.Mount) ([]pathMapping, error)

FilesToPathMappings converts a list of absolute local filepaths into pathMappings (i.e. associates local filepaths with their mounts and destination paths).

func FilterByLabel

func FilterByLabel(label dockerfile.Label) filters.KeyValuePair

func FilterByLabelValue

func FilterByLabelValue(label dockerfile.Label, val dockerfile.LabelValue) filters.KeyValuePair

func FilterByRefName

func FilterByRefName(ref reference.Named) filters.KeyValuePair

func FilterMappings

func FilterMappings(mappings []pathMapping, matcher model.PathMatcher) ([]pathMapping, error)

func IsUserBuildFailure

func IsUserBuildFailure(err error) bool

func MissingLocalPaths

func MissingLocalPaths(ctx context.Context, mappings []pathMapping) ([]pathMapping, error)

Return all the path mappings for local paths that do not exist.

func MountsToPathMappings

func MountsToPathMappings(mounts []model.Mount) []pathMapping

func NewDockerImageBuilder

func NewDockerImageBuilder(dcli docker.DockerClient, console console.Console, out io.Writer, extraLabels dockerfile.Labels) *dockerImageBuilder

func Options

func Options(archive io.Reader, args model.DockerBuildArgs) types.ImageBuildOptions

func PathMappingsToContainerPaths

func PathMappingsToContainerPaths(mappings []pathMapping) []string

Types

type ArchiveBuilder

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

func NewArchiveBuilder

func NewArchiveBuilder(filter model.PathMatcher) *ArchiveBuilder

func (*ArchiveBuilder) ArchivePathsIfExist

func (a *ArchiveBuilder) ArchivePathsIfExist(ctx context.Context, paths []pathMapping) error

ArchivePathsIfExist creates a tar archive of all local files in `paths`. It quietly skips any paths that don't exist.

func (*ArchiveBuilder) BytesBuffer

func (a *ArchiveBuilder) BytesBuffer() (*bytes.Buffer, error)

type CacheBuilder added in v0.2.0

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

Reads and writes images that contain cache directories.

Used in the directory cache experimental feature, and designed to be deleted easily if that experiment doesn't work out.

https://app.clubhouse.io/windmill/story/728/support-package-json-changes-gracefully

func NewCacheBuilder added in v0.2.0

func NewCacheBuilder(dcli docker.DockerClient) CacheBuilder

func (CacheBuilder) CreateCacheFrom added in v0.2.0

func (b CacheBuilder) CreateCacheFrom(ctx context.Context, baseDf dockerfile.Dockerfile, sourceRef reference.NamedTagged, cachePaths []string, buildArgs model.DockerBuildArgs) error

Creates a cache image.

func (CacheBuilder) FetchCache added in v0.2.0

func (b CacheBuilder) FetchCache(ctx context.Context, ref reference.Named, cachePaths []string) (reference.NamedTagged, error)

Check if a cache exists for this ref name.

type ContainerResolver

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

func NewContainerResolver

func NewContainerResolver(dcli docker.DockerClient) *ContainerResolver

func (*ContainerResolver) ContainerIDForPod

func (r *ContainerResolver) ContainerIDForPod(ctx context.Context, podName k8s.PodID, image reference.NamedTagged) (container.ID, error)

containerIdForPod looks for the container ID associated with the pod and image ID

type ContainerUpdater

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

func NewContainerUpdater

func NewContainerUpdater(dcli docker.DockerClient) *ContainerUpdater

func (*ContainerUpdater) RmPathsFromContainer

func (r *ContainerUpdater) RmPathsFromContainer(ctx context.Context, cID container.ID, paths []pathMapping) error

func (*ContainerUpdater) UpdateInContainer

func (r *ContainerUpdater) UpdateInContainer(ctx context.Context, cID container.ID, paths []pathMapping, filter model.PathMatcher, steps []model.Cmd, w io.Writer) error

type ImageBuilder

type ImageBuilder interface {
	BuildDockerfile(ctx context.Context, ps *PipelineState, ref reference.Named, df dockerfile.Dockerfile, buildPath string, filter model.PathMatcher, buildArgs map[string]string) (reference.NamedTagged, error)
	BuildImageFromScratch(ctx context.Context, ps *PipelineState, ref reference.Named, baseDockerfile dockerfile.Dockerfile, mounts []model.Mount, filter model.PathMatcher, steps []model.Step, entrypoint model.Cmd) (reference.NamedTagged, error)
	BuildImageFromExisting(ctx context.Context, ps *PipelineState, existing reference.NamedTagged, paths []pathMapping, filter model.PathMatcher, steps []model.Step) (reference.NamedTagged, error)
	PushImage(ctx context.Context, name reference.NamedTagged, writer io.Writer) (reference.NamedTagged, error)
	TagImage(ctx context.Context, name reference.Named, dig digest.Digest) (reference.NamedTagged, error)
}

func DefaultImageBuilder

func DefaultImageBuilder(b *dockerImageBuilder) ImageBuilder

type ImageReaper

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

func NewImageReaper

func NewImageReaper(docker docker.DockerClient) ImageReaper

func (ImageReaper) RemoveTiltImages

func (r ImageReaper) RemoveTiltImages(ctx context.Context, createdBefore time.Time, force bool, extraFilters ...filters.KeyValuePair) error

Delete all Tilt builds

For safety reasons, we only delete images with the tilt.buildMode label, but we let the caller set additional filters.

type PathMappingErr

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

func (*PathMappingErr) Error

func (e *PathMappingErr) Error() string

type PipelineState

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

func NewPipelineState

func NewPipelineState(ctx context.Context, totalStepCount int) *PipelineState

func (*PipelineState) End

func (ps *PipelineState) End(ctx context.Context, err error)

NOTE(maia): this func should always be deferred in a closure, so that the `err` arg is bound at the time of calling rather than at the time of deferring. I.e., do:

defer func() { ps.End(err) }()

and NOT:

defer ps.End(err)

func (*PipelineState) EndPipelineStep

func (ps *PipelineState) EndPipelineStep(ctx context.Context)

func (*PipelineState) Printf

func (ps *PipelineState) Printf(ctx context.Context, format string, a ...interface{})

func (*PipelineState) StartBuildStep

func (ps *PipelineState) StartBuildStep(ctx context.Context, format string, a ...interface{})

func (*PipelineState) StartPipelineStep

func (ps *PipelineState) StartPipelineStep(ctx context.Context, format string, a ...interface{})

func (*PipelineState) Writer

func (ps *PipelineState) Writer(ctx context.Context) io.Writer

type UserBuildFailure

type UserBuildFailure struct {
	ExitCode int
}

Indicates that the build failed because the user script failed (as opposed to an infrastructure issue).

func (UserBuildFailure) Error

func (e UserBuildFailure) Error() string

Jump to

Keyboard shortcuts

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