build

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAddInDockerfile = errors.New("base Dockerfile contains an ADD/COPY, " +
	"which is not currently supported -- move this to an add() call in your Tiltfile")
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 Label) filters.KeyValuePair

func FilterByLabelValue

func FilterByLabelValue(label Label, val 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 Labels) *dockerImageBuilder

func Options

func Options(archive io.Reader) 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 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) (k8s.ContainerID, 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 k8s.ContainerID, paths []pathMapping) error

func (*ContainerUpdater) UpdateInContainer

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

type Dockerfile

type Dockerfile string

func DockerfileFromExisting

func DockerfileFromExisting(existing reference.NamedTagged) Dockerfile

DockerfileFromExisting creates a new Dockerfile that uses the supplied image as its base image with a FROM statement. This is necessary for iterative Docker builds.

func (Dockerfile) AddAll

func (d Dockerfile) AddAll() Dockerfile

func (Dockerfile) Entrypoint

func (d Dockerfile) Entrypoint(cmd model.Cmd) Dockerfile

func (Dockerfile) RmPaths

func (d Dockerfile) RmPaths(pathsToRm []pathMapping) Dockerfile

func (Dockerfile) Run

func (d Dockerfile) Run(cmd model.Cmd) Dockerfile

func (Dockerfile) String

func (d Dockerfile) String() string

func (Dockerfile) ValidateBaseDockerfile

func (d Dockerfile) ValidateBaseDockerfile() error

func (Dockerfile) WithLabel

func (d Dockerfile) WithLabel(label Label, val LabelValue) Dockerfile

type ImageBuilder

type ImageBuilder interface {
	BuildDockerfile(ctx context.Context, ps *PipelineState, ref reference.Named, df Dockerfile, buildPath string, filter model.PathMatcher) (reference.NamedTagged, error)
	BuildImageFromScratch(ctx context.Context, ps *PipelineState, ref reference.Named, baseDockerfile 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 Label

type Label string
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 Label = "tilt.buildMode"

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

type LabelValue

type LabelValue string
const (
	BuildModeScratch  LabelValue = "scratch"
	BuildModeExisting            = "existing"
)

type Labels

type Labels map[Label]LabelValue

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