Documentation ¶
Index ¶
- Constants
- Variables
- func BoilSteps(steps []model.Step, pathMappings []PathMapping) ([]model.Cmd, error)
- func DefaultConsole() console.Console
- func DefaultOut() io.Writer
- func FileBelongsToMount(file string, mounts []model.Mount) bool
- func FilterByLabel(label dockerfile.Label) filters.KeyValuePair
- func FilterByLabelValue(label dockerfile.Label, val dockerfile.LabelValue) filters.KeyValuePair
- func FilterByRefName(ref reference.Named) filters.KeyValuePair
- func IsUserBuildFailure(err error) bool
- func NewDockerImageBuilder(dCli docker.Client, console console.Console, out io.Writer, ...) *dockerImageBuilder
- func Options(archive io.Reader, args model.DockerBuildArgs) docker.BuildOptions
- func PathMappingsToContainerPaths(mappings []PathMapping) []string
- func WrapContainerExecError(err error, cID container.ID, cmd model.Cmd) error
- type ArchiveBuilder
- type CacheBuilder
- type CacheInputs
- type CacheRef
- type Clock
- type ContainerUpdater
- type ImageBuilder
- type ImageReaper
- type PathMapping
- func FilesToPathMappings(files []string, mounts []model.Mount) ([]PathMapping, error)
- func FilterMappings(mappings []PathMapping, matcher model.PathMatcher) ([]PathMapping, error)
- func MissingLocalPaths(ctx context.Context, mappings []PathMapping) ([]PathMapping, error)
- func MountsToPathMappings(mounts []model.Mount) []PathMapping
- type PathMappingErr
- type PipelineState
- func (ps *PipelineState) End(ctx context.Context, err error)
- func (ps *PipelineState) EndPipelineStep(ctx context.Context)
- func (ps *PipelineState) Printf(ctx context.Context, format string, a ...interface{})
- func (ps *PipelineState) StartBuildStep(ctx context.Context, format string, a ...interface{})
- func (ps *PipelineState) StartPipelineStep(ctx context.Context, format string, a ...interface{})
- func (ps *PipelineState) Writer(ctx context.Context) io.Writer
- type UserBuildFailure
Constants ¶
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" )
const ( BuildModeScratch dockerfile.LabelValue = "scratch" BuildModeExisting = "existing" )
const CacheTagPrefix = "tilt-cache-"
Cache directories are stored at the same image name, but with just the cachedir contents and at a particular tag.
const TaskKillExitCode = 137
https://success.docker.com/article/what-causes-a-container-to-exit-with-code-137
Variables ¶
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 DefaultConsole ¶
func DefaultOut ¶
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 IsUserBuildFailure ¶
func NewDockerImageBuilder ¶
func Options ¶
func Options(archive io.Reader, args model.DockerBuildArgs) docker.BuildOptions
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.Client) CacheBuilder
func (CacheBuilder) CreateCacheFrom ¶ added in v0.2.0
func (b CacheBuilder) CreateCacheFrom(ctx context.Context, inputs CacheInputs, sourceRef reference.NamedTagged, buildArgs model.DockerBuildArgs) error
Creates a cache image.
func (CacheBuilder) FetchCache ¶ added in v0.2.0
func (b CacheBuilder) FetchCache(ctx context.Context, inputs CacheInputs) (CacheRef, error)
Check if a cache exists for this ref name.
type CacheInputs ¶ added in v0.7.5
type CacheInputs struct { Ref reference.Named CachePaths []string BaseDockerfile dockerfile.Dockerfile }
type CacheRef ¶ added in v0.7.5
type CacheRef reference.NamedTagged
type Clock ¶ added in v0.5.0
func ProvideClock ¶ added in v0.5.0
func ProvideClock() Clock
type ContainerUpdater ¶
type ContainerUpdater struct {
// contains filtered or unexported fields
}
func NewContainerUpdater ¶
func NewContainerUpdater(dCli docker.Client) *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, hotReload bool, 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.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 PathMapping ¶ added in v0.5.0
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 static builds, this is no longer the case.
TODO(nick): Do a pass on renaming all the path types
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 FilterMappings ¶
func FilterMappings(mappings []PathMapping, matcher model.PathMatcher) ([]PathMapping, error)
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 (PathMapping) Filter ¶ added in v0.5.0
func (m PathMapping) Filter(matcher model.PathMatcher) ([]PathMapping, error)
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, c Clock) *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{})
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