model

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const BuildHistoryLimit = 2
View Source
const BuildReasonNone = BuildReason(0)
View Source
const GlobalYAMLManifestName = ManifestName("k8s_yaml")

TODO(maia): throw an error if you try to name a manifest this in your Tiltfile?

Variables

This section is empty.

Functions

func DeepEqual added in v0.4.1

func DeepEqual(x, y interface{}) bool

func NewSimpleFileMatcher

func NewSimpleFileMatcher(paths ...string) (fileMatcher, error)

Types

type BuildDetails added in v0.4.1

type BuildDetails interface {
	// contains filtered or unexported methods
}

type BuildReason added in v0.2.0

type BuildReason int
const (
	BuildReasonFlagMountFiles BuildReason = 1 << iota
	BuildReasonFlagConfig

	// See comments on NeedsRebuildFromCrash
	BuildReasonFlagCrash

	BuildReasonFlagInit
)

func (BuildReason) Has added in v0.2.0

func (r BuildReason) Has(flag BuildReason) bool

func (BuildReason) IsCrashOnly added in v0.2.0

func (r BuildReason) IsCrashOnly() bool

func (BuildReason) With added in v0.2.0

func (r BuildReason) With(flag BuildReason) BuildReason

type BuildStatus added in v0.4.1

type BuildStatus struct {
	Edits      []string
	Error      error
	StartTime  time.Time
	FinishTime time.Time // IsZero() == true for in-progress builds
	Reason     BuildReason
	Log        []byte `testdiff:"ignore"`
}

func (BuildStatus) Duration added in v0.4.1

func (bs BuildStatus) Duration() time.Duration

func (BuildStatus) Empty added in v0.4.1

func (bs BuildStatus) Empty() bool

type Cmd

type Cmd struct {
	Argv []string
}

func ToShellCmd

func ToShellCmd(cmd string) Cmd

func ToShellCmds

func ToShellCmds(cmds []string) []Cmd

func TrySquash

func TrySquash(steps []Cmd) []Cmd

func (Cmd) Empty

func (c Cmd) Empty() bool

func (Cmd) EntrypointStr

func (c Cmd) EntrypointStr() string

func (Cmd) Equal

func (c1 Cmd) Equal(c2 Cmd) bool

func (Cmd) IsShellStandardForm

func (c Cmd) IsShellStandardForm() bool

func (Cmd) RunStr

func (c Cmd) RunStr() string

func (Cmd) ShellStandardScript

func (c Cmd) ShellStandardScript() string

Get the script when the shell is in standard form. Panics if the command is not in shell standard form.

func (Cmd) String

func (c Cmd) String() string

type CompositePathMatcher

type CompositePathMatcher struct {
	Matchers []PathMatcher
}

func (CompositePathMatcher) Matches

func (c CompositePathMatcher) Matches(f string, isDir bool) (bool, error)

type CompositePatternMatcher

type CompositePatternMatcher struct {
	CompositePathMatcher
	Matchers []PatternMatcher
}

func (CompositePatternMatcher) AsMatchPatterns

func (c CompositePatternMatcher) AsMatchPatterns() []string

type DockerBuildArgs added in v0.2.0

type DockerBuildArgs map[string]string

type DockerComposeTarget added in v0.4.3

type DockerComposeTarget struct {
	Name       TargetName
	ConfigPath string
	Mounts     []Mount
	YAMLRaw    []byte // for diff'ing when config files change
	DfRaw      []byte // for diff'ing when config files change
}

func (DockerComposeTarget) ID added in v0.4.3

type Dockerignore added in v0.4.1

type Dockerignore struct {
	// The path to evaluate the dockerignore contents relative to
	LocalPath string
	Contents  string
}

type FastBuild added in v0.4.1

type FastBuild struct {
	BaseDockerfile string
	Mounts         []Mount
	Steps          []Step
	Entrypoint     Cmd
}

func (FastBuild) Empty added in v0.4.1

func (fb FastBuild) Empty() bool

type ImageTarget added in v0.4.3

type ImageTarget struct {
	Ref          reference.Named
	BuildDetails BuildDetails
	// contains filtered or unexported fields
}

func (ImageTarget) CachePaths added in v0.4.3

func (di ImageTarget) CachePaths() []string

func (ImageTarget) ID added in v0.4.3

func (di ImageTarget) ID() TargetID

func (ImageTarget) WithBuildDetails added in v0.4.3

func (di ImageTarget) WithBuildDetails(details BuildDetails) ImageTarget

func (ImageTarget) WithCachePaths added in v0.4.3

func (di ImageTarget) WithCachePaths(paths []string) ImageTarget

type K8sTarget added in v0.4.3

type K8sTarget struct {
	Name         TargetName
	YAML         string
	PortForwards []PortForward
}

func (K8sTarget) AppendYAML added in v0.4.3

func (k8s K8sTarget) AppendYAML(y string) K8sTarget

func (K8sTarget) ID added in v0.4.3

func (k8s K8sTarget) ID() TargetID

type LocalGitRepo added in v0.4.3

type LocalGitRepo struct {
	LocalPath         string
	GitignoreContents string
}

func (LocalGitRepo) IsRepo added in v0.4.3

func (LocalGitRepo) IsRepo()

type Manifest

type Manifest struct {
	// Properties for all manifests.
	Name ManifestName

	// Info needed to Docker build an image. (This struct contains details of StaticBuild, FastBuild... etc.)
	// (If we ever support multiple build engines, this can become an interface wildcard similar to `deployTarget`).
	ImageTarget ImageTarget
	// contains filtered or unexported fields
}

NOTE: If you modify Manifest, make sure to modify `Manifest.Equal` appropriately

func (Manifest) Dependencies added in v0.1.0

func (m Manifest) Dependencies() []string

func (Manifest) DockerComposeTarget added in v0.4.3

func (m Manifest) DockerComposeTarget() DockerComposeTarget

func (Manifest) Dockerignores added in v0.4.1

func (m Manifest) Dockerignores() []Dockerignore

func (Manifest) Equal

func (m1 Manifest) Equal(m2 Manifest) bool

func (Manifest) FastBuildInfo added in v0.4.1

func (m Manifest) FastBuildInfo() FastBuild

func (Manifest) ID added in v0.4.3

func (m Manifest) ID() TargetID

func (Manifest) IsDC added in v0.4.1

func (m Manifest) IsDC() bool

func (Manifest) IsFastBuild added in v0.4.1

func (m Manifest) IsFastBuild() bool

func (Manifest) IsK8s added in v0.4.1

func (m Manifest) IsK8s() bool

func (Manifest) IsStaticBuild

func (m Manifest) IsStaticBuild() bool

func (Manifest) K8sTarget added in v0.4.3

func (m Manifest) K8sTarget() K8sTarget

func (Manifest) LocalPaths

func (m Manifest) LocalPaths() []string

func (Manifest) LocalRepos added in v0.1.0

func (m Manifest) LocalRepos() []LocalGitRepo

func (Manifest) ManifestName added in v0.1.0

func (m Manifest) ManifestName() ManifestName

func (Manifest) StaticBuildInfo added in v0.4.1

func (m Manifest) StaticBuildInfo() StaticBuild

func (Manifest) TiltFilename

func (m Manifest) TiltFilename() string

func (Manifest) Validate

func (m Manifest) Validate() error

func (Manifest) ValidateDockerK8sManifest added in v0.4.1

func (m Manifest) ValidateDockerK8sManifest() error

ValidateDockerK8sManifest indicates whether this manifest is a valid Docker-buildable & k8s-deployable manifest.

func (Manifest) WithConfigFiles added in v0.1.0

func (m Manifest) WithConfigFiles(confFiles []string) Manifest

func (Manifest) WithDeployTarget added in v0.4.3

func (m Manifest) WithDeployTarget(t Target) Manifest

func (Manifest) WithDockerignores added in v0.4.1

func (m Manifest) WithDockerignores(dockerignores []Dockerignore) Manifest

func (Manifest) WithRepos added in v0.4.1

func (m Manifest) WithRepos(repos []LocalGitRepo) Manifest

func (Manifest) WithTiltFilename added in v0.1.0

func (m Manifest) WithTiltFilename(f string) Manifest

type ManifestName

type ManifestName string

TODO(nick): We should probably get rid of ManifestName completely and just use TargetName everywhere.

func (ManifestName) String

func (m ManifestName) String() string

func (ManifestName) TargetName added in v0.4.3

func (m ManifestName) TargetName() TargetName

type Mount

type Mount struct {
	LocalPath     string
	ContainerPath string
}

type PathMatcher

type PathMatcher interface {
	Matches(f string, isDir bool) (bool, error)
}
var EmptyMatcher PathMatcher = emptyMatcher{}

func NewCompositeMatcher

func NewCompositeMatcher(matchers []PathMatcher) PathMatcher

func NewGlobMatcher added in v0.1.0

func NewGlobMatcher(globs ...string) PathMatcher

type PatternMatcher

type PatternMatcher interface {
	PathMatcher

	// Express this PathMatcher as a sequence of filepath.Match
	// patterns. These patterns are widely useful in Docker-land because
	// they're suitable in .dockerignore or Dockerfile ADD statements
	// https://docs.docker.com/engine/reference/builder/#add
	AsMatchPatterns() []string
}

type PortForward

type PortForward struct {
	// The port to expose on localhost of the current machine.
	LocalPort int

	// The port to connect to inside the deployed container.
	// If 0, we will connect to the first containerPort.
	ContainerPort int
}

type StaticBuild added in v0.4.1

type StaticBuild struct {
	Dockerfile string
	BuildPath  string // the absolute path to the files
	BuildArgs  DockerBuildArgs
}

func (StaticBuild) Empty added in v0.4.1

func (sb StaticBuild) Empty() bool

type Step

type Step struct {
	// Required. The command to run in this step.
	Cmd Cmd
	// Optional. If not specified, this step runs on every change.
	// If specified, we only run the Cmd if the trigger matches the changed file.
	Triggers []string
	// Directory the Triggers are relative to
	BaseDirectory string
}

func ToShellSteps

func ToShellSteps(cwd string, cmds []string) []Step

func ToStep

func ToStep(cwd string, cmd Cmd) Step

func ToSteps

func ToSteps(cwd string, cmds []Cmd) []Step

func (Step) Equal

func (s1 Step) Equal(s2 Step) bool

type Target added in v0.4.3

type Target interface {
	ID() TargetID
}

type TargetID added in v0.4.3

type TargetID struct {
	Type TargetType
	Name TargetName
}

func (TargetID) Empty added in v0.4.3

func (id TargetID) Empty() bool

func (TargetID) String added in v0.4.3

func (id TargetID) String() string

type TargetName added in v0.4.3

type TargetName string

func (TargetName) String added in v0.4.3

func (n TargetName) String() string

type TargetStatus added in v0.4.3

type TargetStatus interface {
	TargetID() TargetID
	ActiveBuild() BuildStatus
	LastBuild() BuildStatus
}

type TargetType added in v0.4.3

type TargetType string
const (
	// Deployed k8s entities
	TargetTypeK8s TargetType = "k8s"

	// Image builds
	// TODO(nick): It might make sense to represent FastBuild and normal Docker builds
	// as separate types.
	TargetTypeImage TargetType = "image"

	// Docker-compose service build and deploy
	// TODO(nick): Currently, build and deploy are represented as a single target.
	// In the future, we might have a separate build target and deploy target.
	TargetTypeDockerCompose TargetType = "docker-compose"

	// Aggregation of multiple targets into one UI view.
	// TODO(nick): Currenly used as the type for both Manifest and YAMLManifest, though
	// we expect YAMLManifest to go away.
	TargetTypeManifest TargetType = "manifest"
)

type TriggerMode added in v0.4.1

type TriggerMode int
const (
	TriggerAuto TriggerMode = iota
	TriggerManual
)

type YAMLManifest added in v0.1.0

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

TODO(nick): Delete YAML Manifest and make it a generic ManifestTarget.

func NewYAMLManifest added in v0.1.0

func NewYAMLManifest(name ManifestName, k8sYaml string, configFiles []string, resourceNames []string) YAMLManifest

func (YAMLManifest) ConfigMatcher added in v0.1.0

func (y YAMLManifest) ConfigMatcher() (PathMatcher, error)

func (YAMLManifest) Dependencies added in v0.1.0

func (y YAMLManifest) Dependencies() []string

func (YAMLManifest) Empty added in v0.4.1

func (y YAMLManifest) Empty() bool

func (YAMLManifest) ID added in v0.4.3

func (y YAMLManifest) ID() TargetID

func (YAMLManifest) K8sYAML added in v0.1.0

func (y YAMLManifest) K8sYAML() string

func (YAMLManifest) ManifestName added in v0.1.0

func (y YAMLManifest) ManifestName() ManifestName

func (YAMLManifest) Resources added in v0.4.1

func (y YAMLManifest) Resources() []string

Jump to

Keyboard shortcuts

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