build

package
v0.33.21 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 53 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 dockerfile.Label = "tilt.test"

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

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 BoilRuns added in v0.7.11

func BoilRuns(runs []model.Run, pathMappings []PathMapping) ([]model.Cmd, error)

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 InjectClusterPlatform added in v0.23.5

func InjectClusterPlatform(spec v1alpha1.DockerImageSpec, cluster *v1alpha1.Cluster) v1alpha1.DockerImageSpec

Create a new ImageTarget with the platform OS/Arch from the target cluster.

func InjectImageDependencies added in v0.23.5

func InjectImageDependencies(spec v1alpha1.DockerImageSpec, imageMaps map[types.NamespacedName]*v1alpha1.ImageMap) (v1alpha1.DockerImageSpec, error)

Create a new ImageTarget with the Dockerfiles rewritten with the injected images.

func IsRunStepFailure added in v0.9.7

func IsRunStepFailure(err error) bool

func Options

func Options(archive io.Reader, spec v1alpha1.DockerImageSpec) docker.BuildOptions

func PathMappingsToContainerPaths

func PathMappingsToContainerPaths(mappings []PathMapping) []string

func PathMappingsToLocalPaths added in v0.7.11

func PathMappingsToLocalPaths(mappings []PathMapping) []string

func TarArchiveForPaths added in v0.10.0

func TarArchiveForPaths(ctx context.Context, toArchive []PathMapping, filter model.PathMatcher) io.ReadCloser

func TarPath added in v0.9.3

func TarPath(ctx context.Context, writer io.Writer, path string) error

Types

type ArchiveBuilder

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

func NewArchiveBuilder

func NewArchiveBuilder(writer io.Writer, 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) Close added in v0.9.4

func (a *ArchiveBuilder) Close() error

func (*ArchiveBuilder) Paths added in v0.7.11

func (a *ArchiveBuilder) Paths() []string

Local paths that were archived

type Clock added in v0.5.0

type Clock interface {
	Now() time.Time
}

func ProvideClock added in v0.5.0

func ProvideClock() Clock

type CustomBuilder added in v0.7.11

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

func NewCustomBuilder added in v0.23.5

func NewCustomBuilder(dCli docker.Client, clock Clock, cmds *cmd.Controller) *CustomBuilder

func (*CustomBuilder) Build added in v0.7.11

type DockerBuilder added in v0.14.1

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

func NewDockerBuilder added in v0.23.5

func NewDockerBuilder(dCli docker.Client, extraLabels dockerfile.Labels) *DockerBuilder

func (*DockerBuilder) BuildImage added in v0.14.1

func (*DockerBuilder) DumpImageDeployRef added in v0.17.0

func (d *DockerBuilder) DumpImageDeployRef(ctx context.Context, ref string) (reference.NamedTagged, error)

func (*DockerBuilder) ImageExists added in v0.14.1

func (d *DockerBuilder) ImageExists(ctx context.Context, ref reference.NamedTagged) (bool, error)

func (*DockerBuilder) PushImage added in v0.14.1

func (d *DockerBuilder) PushImage(ctx context.Context, ref reference.NamedTagged) error

Push the specified ref up to the docker registry specified in the name.

TODO(nick) In the future, I would like us to be smarter about checking if the kubernetes cluster we're running in has access to the given registry. And if it doesn't, we should either emit an error, or push to a registry that kubernetes does have access to (e.g., a local registry).

func (*DockerBuilder) TagRefs added in v0.14.1

func (d *DockerBuilder) TagRefs(ctx context.Context, refs container.RefSet, dig digest.Digest) (container.TaggedRefs, error)

Tag the digest with the given name and wm-tilt tag.

func (*DockerBuilder) WillBuildToKubeContext added in v0.20.7

func (d *DockerBuilder) WillBuildToKubeContext(kctx k8s.KubeContext) bool

type DockerKubeConnection added in v0.20.9

type DockerKubeConnection interface {
	// Returns whether this docker builder is going to build to the given kubernetes context.
	WillBuildToKubeContext(kctx k8s.KubeContext) bool
}

Describes how a docker instance connects to kubernetes instances.

type ImageBuilder

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

func NewImageBuilder added in v0.27.1

func NewImageBuilder(db *DockerBuilder, custb *CustomBuilder, kl KINDLoader) *ImageBuilder

func (*ImageBuilder) Build added in v0.27.1

Build the image, and push it if necessary.

Note that this function can return partial results on an error.

The error is simply the "main" build failure reason.

func (*ImageBuilder) CanReuseRef added in v0.27.1

func (ib *ImageBuilder) CanReuseRef(ctx context.Context, iTarget model.ImageTarget, ref reference.NamedTagged) (bool, error)

type ImageReaper

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

func NewImageReaper

func NewImageReaper(docker docker.Client) 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 KINDLoader added in v0.27.1

type KINDLoader interface {
	LoadToKIND(ctx context.Context, cluster *v1alpha1.Cluster, ref reference.NamedTagged) error
}

func NewKINDLoader added in v0.27.1

func NewKINDLoader() KINDLoader

type PathMapping added in v0.5.0

type PathMapping struct {
	LocalPath     string
	ContainerPath string
}

PathMapping represents a mapping from the local path to the tarball path

To send a local file into a container, we copy it into a tarball, send the tarball to docker, and then run a sequence of steps to unpack the tarball in the container file system.

That means every file has 3 paths: 1) LocalPath 2) TarballPath 3) ContainerPath

In incremental builds, TarballPath and ContainerPath are always the same, so it was correct to use TarballPath and ContainerPath interchangeably.

In DockerBuilds, this is no longer the case.

TODO(nick): Do a pass on renaming all the path types

func FilesToPathMappings

func FilesToPathMappings(files []string, syncs []model.Sync) ([]PathMapping, []string, error)

FilesToPathMappings converts a list of absolute local filepaths into pathMappings (i.e. associates local filepaths with their syncs and destination paths), returning those that it cannot associate with a sync.

func FilterMappings

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

func MissingLocalPaths

func MissingLocalPaths(ctx context.Context, mappings []PathMapping) (missing, rest []PathMapping, err error)

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

func SyncsToPathMappings added in v0.7.11

func SyncsToPathMappings(syncs []model.Sync) []PathMapping

func (PathMapping) Filter added in v0.5.0

func (m PathMapping) Filter(matcher model.PathMatcher) ([]PathMapping, error)

func (PathMapping) PrettyStr added in v0.7.12

func (m PathMapping) PrettyStr() string

type PipelineState

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

func NewPipelineState

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

func (*PipelineState) AttachLogger added in v0.14.0

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

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(ctx, err) }()

and NOT:

defer ps.End(ctx, 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{})

type PipelineStep added in v0.19.3

type PipelineStep struct {
	Name      string // for logging
	StartTime time.Time
	Duration  time.Duration // not populated until end of the step
}

type ProgressWriter added in v0.23.0

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

A little utility class that tracks how many bytes we've written, to the Docker context.

func NewProgressWriter added in v0.23.0

func NewProgressWriter(ctx context.Context, w io.Writer) *ProgressWriter

func (*ProgressWriter) Close added in v0.23.0

func (w *ProgressWriter) Close()

func (*ProgressWriter) Init added in v0.23.0

func (w *ProgressWriter) Init()

func (*ProgressWriter) Write added in v0.23.0

func (w *ProgressWriter) Write(b []byte) (int, error)

type RunStepFailure added in v0.9.7

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

RunStepFailure indicates that the update failed because one of the user's Runs failed (i.e. exited non-zero) -- as opposed to an infrastructure issue.

func NewRunStepFailure added in v0.26.0

func NewRunStepFailure(err error) RunStepFailure

func (RunStepFailure) Error added in v0.9.7

func (e RunStepFailure) Error() string

func (RunStepFailure) Unwrap added in v0.26.0

func (e RunStepFailure) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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