Documentation ¶
Index ¶
- Constants
- Variables
- func AfterOrEqual(a, b time.Time) bool
- func BeforeOrEqual(a, b time.Time) bool
- func ClusterImageRefFromBuildResult(r BuildResult) reference.NamedTagged
- func CreateEngineStateEncoder(w io.Writer) *json.Encoder
- func IDsForInfos(infos []ContainerInfo) []container.ID
- func LocalImageRefFromBuildResult(r BuildResult) reference.NamedTagged
- func ManifestTargetEndpoints(mt *ManifestTarget) (endpoints []string)
- func NewLogActionLogger(ctx context.Context, dispatch func(action Action)) logger.Logger
- func SafeGo(store RStore, f func())
- func StateToView(s EngineState, mu *sync.RWMutex) view.View
- type Action
- type AnalyticsNudgeSurfacedAction
- type AnalyticsUserOptAction
- type BuildResult
- type BuildResultSet
- func (set BuildResultSet) BuildTypes() []model.BuildType
- func (set BuildResultSet) DeployedPodTemplateSpecHashes() PodTemplateSpecHashSet
- func (set BuildResultSet) DeployedUIDSet() UIDSet
- func (set BuildResultSet) LiveUpdatedContainerIDs() []container.ID
- func (set BuildResultSet) OneAndOnlyLiveUpdatedContainerID() container.ID
- type BuildState
- func (b BuildState) FilesChanged() []string
- func (b BuildState) HasLastResult() bool
- func (b BuildState) IsEmpty() bool
- func (b BuildState) LastLocalImageAsString() string
- func (b BuildState) NeedsImageBuild() bool
- func (b BuildState) OneContainerInfo() ContainerInfo
- func (b BuildState) WithFullBuildTriggered(isImageBuildTrigger bool) BuildState
- func (b BuildState) WithRunningContainerError(err error) BuildState
- func (b BuildState) WithRunningContainers(cInfos []ContainerInfo) BuildState
- type BuildStateSet
- type BuildStatus
- type CloudStatus
- type Container
- type ContainerInfo
- type DockerComposeBuildResult
- type EngineMode
- type EngineState
- func (e *EngineState) AnalyticsEffectiveOpt() analytics.Opt
- func (e *EngineState) AvailableBuildSlots() int
- func (e *EngineState) BuildStatus(id model.TargetID) BuildStatus
- func (s EngineState) DockerComposeConfigPath() []string
- func (e *EngineState) HasDockerBuild() bool
- func (e *EngineState) InitialBuildsCompleted() bool
- func (e *EngineState) IsCurrentlyBuilding(name model.ManifestName) bool
- func (e EngineState) IsEmpty() bool
- func (e EngineState) LastTiltfileError() error
- func (e EngineState) Manifest(mn model.ManifestName) (model.Manifest, bool)
- func (e *EngineState) ManifestInTriggerQueue(mn model.ManifestName) bool
- func (e *EngineState) ManifestNamesForTargetID(id model.TargetID) []model.ManifestName
- func (e EngineState) ManifestState(mn model.ManifestName) (*ManifestState, bool)
- func (e EngineState) ManifestStates() []*ManifestState
- func (e EngineState) Manifests() []model.Manifest
- func (e EngineState) RelativeTiltfilePath() (string, error)
- func (e EngineState) Targets() []*ManifestTarget
- func (e EngineState) TargetsBesides(mn model.ManifestName) []*ManifestTarget
- func (e *EngineState) UpsertManifestTarget(mt *ManifestTarget)
- type ErrorAction
- type ImageBuildResult
- type K8sBuildResult
- type K8sEventAction
- type K8sRuntimeState
- func (s K8sRuntimeState) ContainsID(id k8s.PodID) bool
- func (s K8sRuntimeState) HasEverBeenReadyOrSucceeded() bool
- func (s K8sRuntimeState) HasOKPodTemplateSpecHash(pod *v1.Pod) bool
- func (s K8sRuntimeState) MostRecentPod() Pod
- func (s K8sRuntimeState) PodLen() int
- func (s K8sRuntimeState) PodList() []Pod
- func (K8sRuntimeState) RuntimeState()
- func (s K8sRuntimeState) RuntimeStatus() model.RuntimeStatus
- func (s K8sRuntimeState) RuntimeStatusError() error
- type LiveUpdateBuildResult
- type LocalBuildResult
- type LocalRuntimeState
- type LogAction
- func (LogAction) Action()
- func (le LogAction) Fields() logger.Fields
- func (le LogAction) Level() logger.Level
- func (le LogAction) ManifestName() model.ManifestName
- func (le LogAction) Message() []byte
- func (le LogAction) SpanID() logstore.SpanID
- func (le LogAction) String() string
- func (le LogAction) Time() time.Time
- type LogActionsFlag
- type ManifestState
- func (ms *ManifestState) ActiveBuild() model.BuildRecord
- func (ms *ManifestState) AddCompletedBuild(bs model.BuildRecord)
- func (ms *ManifestState) BuildStatus(id model.TargetID) BuildStatus
- func (ms *ManifestState) DCRuntimeState() dockercompose.State
- func (ms *ManifestState) HasPendingChanges() (bool, time.Time)
- func (ms *ManifestState) HasPendingChangesBeforeOrEqual(highWaterMark time.Time) (bool, time.Time)
- func (ms *ManifestState) HasPendingDependencyChanges() bool
- func (ms *ManifestState) HasPendingFileChanges() bool
- func (ms *ManifestState) IsBuilding() bool
- func (ms *ManifestState) IsDC() bool
- func (ms *ManifestState) IsK8s() bool
- func (ms *ManifestState) K8sRuntimeState() K8sRuntimeState
- func (ms *ManifestState) LastBuild() model.BuildRecord
- func (ms *ManifestState) LocalRuntimeState() LocalRuntimeState
- func (ms *ManifestState) MostRecentPod() Pod
- func (ms *ManifestState) MutableBuildStatus(id model.TargetID) *BuildStatus
- func (ms *ManifestState) PodWithID(pid k8s.PodID) (*Pod, bool)
- func (ms *ManifestState) StartedFirstBuild() bool
- func (ms *ManifestState) TargetID() model.TargetID
- type ManifestTarget
- type PanicAction
- type Pod
- type PodResetRestartsAction
- type PodTemplateSpecHashSet
- type RStore
- type Reducer
- type RuntimeState
- type SetUpper
- type Store
- func (s *Store) AddSubscriber(ctx context.Context, sub Subscriber)
- func (s *Store) Close()
- func (s *Store) Dispatch(action Action)
- func (s *Store) LockMutableStateForTesting() *EngineState
- func (s *Store) Loop(ctx context.Context) error
- func (s *Store) NotifySubscribers(ctx context.Context)
- func (s *Store) RLockState() EngineState
- func (s *Store) RUnlockState()
- func (s *Store) RemoveSubscriber(ctx context.Context, sub Subscriber) error
- func (s *Store) SetUpSubscribersForTesting(ctx context.Context)
- func (s *Store) StateMutex() *sync.RWMutex
- func (s *Store) UnlockMutableState()
- type Subscriber
- type SubscriberLifecycle
- type TearDowner
- type TerminalMode
- type TestingStore
- func (s *TestingStore) Actions() []Action
- func (s *TestingStore) AssertNoErrorActions(t testing.TB)
- func (s *TestingStore) ClearActions()
- func (s *TestingStore) Dispatch(action Action)
- func (s *TestingStore) LockMutableStateForTesting() *EngineState
- func (s *TestingStore) RLockState() EngineState
- func (s *TestingStore) RUnlockState()
- func (s *TestingStore) SetState(state EngineState)
- func (s *TestingStore) StateMutex() *sync.RWMutex
- func (s *TestingStore) UnlockMutableState()
- func (s *TestingStore) WaitForAction(t testing.TB, typ reflect.Type) Action
- func (s *TestingStore) WithState(f func(state *EngineState))
- type TiltCloudStatusReceivedAction
- type UIDSet
- type UserStartedTiltCloudRegistrationAction
Constants ¶
const TiltfileManifestName = model.TiltfileManifestName
Variables ¶
var ( // "up" is an interactive dev mode that watches files and resources. EngineModeUp = EngineMode{} // "apply" is a dev mode that builds and applies all resources, // but doesn't wait to see if they come up. EngineModeApply = EngineMode{Name: "apply"} // "CI" is a mode that builds and applies all resources, // waits until they come up, then exits. EngineModeCI = EngineMode{Name: "ci"} )
var BuildStateClean = BuildState{}
var EmptyReducer = Reducer(func(ctx context.Context, s *EngineState, action Action) {})
Functions ¶
func AfterOrEqual ¶ added in v0.14.0
Helper functions for comparing times in the store. On Windows, time instants aren't monotonic, so we need to be more tolerant of equal times.
func BeforeOrEqual ¶ added in v0.14.0
func ClusterImageRefFromBuildResult ¶ added in v0.14.0
func ClusterImageRefFromBuildResult(r BuildResult) reference.NamedTagged
func CreateEngineStateEncoder ¶ added in v0.10.18
func IDsForInfos ¶ added in v0.9.7
func IDsForInfos(infos []ContainerInfo) []container.ID
func LocalImageRefFromBuildResult ¶ added in v0.14.0
func LocalImageRefFromBuildResult(r BuildResult) reference.NamedTagged
func ManifestTargetEndpoints ¶ added in v0.5.0
func ManifestTargetEndpoints(mt *ManifestTarget) (endpoints []string)
func NewLogActionLogger ¶ added in v0.8.9
func SafeGo ¶ added in v0.10.22
func SafeGo(store RStore, f func())
Execute the function from a goroutine, recovering any panics and exiting the program gracefully.
This helps tcell reset the terminal to a state where we can print the error correctly, see https://github.com/gdamore/tcell/issues/147 for more discussion.
Otherwise, a panic() would just blow up the terminal and force a reset.
func StateToView ¶
func StateToView(s EngineState, mu *sync.RWMutex) view.View
Types ¶
type Action ¶
type Action interface {
Action()
}
func AssertNoActionOfType ¶ added in v0.8.10
for use by tests (with a real channel-based store, NOT a TestingStore). Assert that we don't see an action of the given type
func WaitForAction ¶ added in v0.8.1
for use by tests (with a real channel-based store, NOT a TestingStore), to wait until an action of the specified type comes out of the given chan at some point we might want it to return the index it was found at, and then take an index, so that we can start searching from the next index
type AnalyticsNudgeSurfacedAction ¶ added in v0.8.7
type AnalyticsNudgeSurfacedAction struct{}
func (AnalyticsNudgeSurfacedAction) Action ¶ added in v0.8.7
func (AnalyticsNudgeSurfacedAction) Action()
type AnalyticsUserOptAction ¶ added in v0.10.16
func (AnalyticsUserOptAction) Action ¶ added in v0.10.16
func (AnalyticsUserOptAction) Action()
type BuildResult ¶
type BuildResult interface { TargetID() model.TargetID BuildType() model.BuildType Facets() []model.Facet }
The results of a build.
If a build is successful, the builder should always return a BuildResult to indicate the output artifacts of the build (e.g., any new images).
If a build is not successful, things get messier. Certain types of failure may still return a result (e.g., a failed live update might return the container IDs where the error happened).
Long-term, we want this interface to be more like Bazel's SpawnResult https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/actions/SpawnResult.java#L36 where a builder always returns a Result, but with a code for each of the different failure types.
func NewK8sDeployResult ¶ added in v0.10.5
func NewK8sDeployResult(id model.TargetID, uids []types.UID, hashes []k8s.PodTemplateSpecHash, appliedEntities []k8s.K8sEntity) BuildResult
For kubernetes deploy targets.
type BuildResultSet ¶ added in v0.5.1
type BuildResultSet map[model.TargetID]BuildResult
func MergeBuildResultsSet ¶ added in v0.10.0
func MergeBuildResultsSet(a, b BuildResultSet) BuildResultSet
func (BuildResultSet) BuildTypes ¶ added in v0.10.14
func (set BuildResultSet) BuildTypes() []model.BuildType
func (BuildResultSet) DeployedPodTemplateSpecHashes ¶ added in v0.10.16
func (set BuildResultSet) DeployedPodTemplateSpecHashes() PodTemplateSpecHashSet
func (BuildResultSet) DeployedUIDSet ¶ added in v0.10.5
func (set BuildResultSet) DeployedUIDSet() UIDSet
func (BuildResultSet) LiveUpdatedContainerIDs ¶ added in v0.10.0
func (set BuildResultSet) LiveUpdatedContainerIDs() []container.ID
func (BuildResultSet) OneAndOnlyLiveUpdatedContainerID ¶ added in v0.10.0
func (set BuildResultSet) OneAndOnlyLiveUpdatedContainerID() container.ID
Returns a container ID iff it's the only container ID in the result set. If there are multiple container IDs, we have to give up.
type BuildState ¶
type BuildState struct { // The last result. LastResult BuildResult // Files changed since the last result was build. // This must be liberal: it's ok if this has too many files, but not ok if it has too few. FilesChangedSet map[string]bool // Dependencies changed since the last result was built DepsChangedSet map[model.TargetID]bool // There are three kinds of triggers: // // 1) If a resource is in trigger_mode=TRIGGER_MODE_AUTO, then the resource auto-builds. // Pressing the trigger will always do a full image build. // // 2) If a resource is in trigger_mode=TRIGGER_MODE_MANUAL and there are no pending changes, // then pressing the trigger will do a full image build. // // 3) If a resource is in trigger_mode=TRIGGER_MODE_MANUAL, and there are // pending changes, then pressing the trigger will do a live_update (if one // is configured; otherwise, will do an image build as normal) // // This field indicates case 1 || case 2 -- i.e. that we should skip // live_update, and force an image build (even if there are no changed files) FullBuildTriggered bool RunningContainers []ContainerInfo // If we had an error retrieving running containers RunningContainerError error }
The state of the system since the last successful build. This data structure should be considered immutable. All methods that return a new BuildState should first clone the existing build state.
func NewBuildState ¶
func NewBuildState(result BuildResult, files []string, pendingDeps []model.TargetID) BuildState
func (BuildState) FilesChanged ¶
func (b BuildState) FilesChanged() []string
Return the files changed since the last result in sorted order. The sorting helps ensure that this is deterministic, both for testing and for deterministic builds.
func (BuildState) HasLastResult ¶ added in v0.15.2
func (b BuildState) HasLastResult() bool
func (BuildState) IsEmpty ¶
func (b BuildState) IsEmpty() bool
A build state is empty if there are no previous results.
func (BuildState) LastLocalImageAsString ¶ added in v0.14.0
func (b BuildState) LastLocalImageAsString() string
func (BuildState) NeedsImageBuild ¶ added in v0.7.11
func (b BuildState) NeedsImageBuild() bool
Whether the image represented by this state needs to be built. If the image has already been built, and no files have been changed since then, then we can re-use the previous result.
func (BuildState) OneContainerInfo ¶ added in v0.9.7
func (b BuildState) OneContainerInfo() ContainerInfo
NOTE(maia): Interim method to replicate old behavior where every BuildState had a single ContainerInfo
func (BuildState) WithFullBuildTriggered ¶ added in v0.14.3
func (b BuildState) WithFullBuildTriggered(isImageBuildTrigger bool) BuildState
func (BuildState) WithRunningContainerError ¶ added in v0.10.15
func (b BuildState) WithRunningContainerError(err error) BuildState
func (BuildState) WithRunningContainers ¶ added in v0.9.7
func (b BuildState) WithRunningContainers(cInfos []ContainerInfo) BuildState
type BuildStateSet ¶ added in v0.5.1
type BuildStateSet map[model.TargetID]BuildState
func (BuildStateSet) Empty ¶ added in v0.5.1
func (set BuildStateSet) Empty() bool
func (BuildStateSet) FilesChanged ¶ added in v0.5.1
func (set BuildStateSet) FilesChanged() []string
func (BuildStateSet) FullBuildTriggered ¶ added in v0.14.3
func (set BuildStateSet) FullBuildTriggered() bool
type BuildStatus ¶ added in v0.5.1
type BuildStatus struct { // Stores the times of all the pending changes, // so we can prioritize the oldest one first. // This map is mutable. PendingFileChanges map[string]time.Time LastResult BuildResult // Stores the times that dependencies were marked dirty, so we can prioritize // the oldest one first. // // Long-term, we want to process all dependencies as a build graph rather than // a list of manifests. Specifically, we'll build one Target at a time. Once // the build completes, we'll look at all the targets that depend on it, and // mark PendingDependencyChanges to indicate that they need a rebuild. // // Short-term, we only use this for cases where two manifests share a common // image. This only handles cross-manifest dependencies. // // This approach allows us to start working on the bookkeeping and // dependency-tracking in the short-term, without having to switch over to a // full dependency graph in one swoop. PendingDependencyChanges map[model.TargetID]time.Time }
TODO(nick): This will eventually implement TargetStatus
func (*BuildStatus) ClearPendingChangesBefore ¶ added in v0.16.0
func (s *BuildStatus) ClearPendingChangesBefore(startTime time.Time)
func (BuildStatus) IsEmpty ¶ added in v0.7.11
func (s BuildStatus) IsEmpty() bool
type CloudStatus ¶ added in v0.14.0
type Container ¶ added in v0.9.6
type ContainerInfo ¶ added in v0.7.11
type ContainerInfo struct { PodID k8s.PodID ContainerID container.ID ContainerName container.Name Namespace k8s.Namespace }
Information describing a single running & ready container
func AllRunningContainers ¶ added in v0.10.0
func AllRunningContainers(mt *ManifestTarget) []ContainerInfo
func RunningContainersForDC ¶ added in v0.9.7
func RunningContainersForDC(state dockercompose.State) []ContainerInfo
func RunningContainersForTargetForOnePod ¶ added in v0.10.0
func RunningContainersForTargetForOnePod(iTarget model.ImageTarget, runtimeState K8sRuntimeState) ([]ContainerInfo, error)
If all containers running the given image are ready, returns info for them. (If this image is running on multiple pods, return an error.)
func (ContainerInfo) Empty ¶ added in v0.9.7
func (c ContainerInfo) Empty() bool
type DockerComposeBuildResult ¶ added in v0.10.14
type DockerComposeBuildResult struct { // The ID of the container that Docker Compose created. // // When we deploy a Docker Compose service, we wait synchronously for the // container to start. Note that this is a different concurrency model than // we use for Kubernetes, where the pods appear some time later via an // asynchronous event. DockerComposeContainerID container.ID // The initial state of the container. ContainerState *dockertypes.ContainerState // contains filtered or unexported fields }
func NewDockerComposeDeployResult ¶ added in v0.10.0
func NewDockerComposeDeployResult(id model.TargetID, containerID container.ID, state *dockertypes.ContainerState) DockerComposeBuildResult
For docker compose deploy targets.
func (DockerComposeBuildResult) BuildType ¶ added in v0.10.14
func (r DockerComposeBuildResult) BuildType() model.BuildType
func (DockerComposeBuildResult) Facets ¶ added in v0.10.16
func (r DockerComposeBuildResult) Facets() []model.Facet
func (DockerComposeBuildResult) TargetID ¶ added in v0.10.14
func (r DockerComposeBuildResult) TargetID() model.TargetID
type EngineMode ¶ added in v0.14.0
type EngineMode struct {
Name string
}
Defines different executions modes for running Tilt, and deciding when to exit.
func (EngineMode) IsApplyMode ¶ added in v0.14.0
func (m EngineMode) IsApplyMode() bool
func (EngineMode) IsCIMode ¶ added in v0.14.0
func (m EngineMode) IsCIMode() bool
func (EngineMode) WatchesFiles ¶ added in v0.14.0
func (m EngineMode) WatchesFiles() bool
func (EngineMode) WatchesRuntime ¶ added in v0.14.0
func (m EngineMode) WatchesRuntime() bool
type EngineState ¶
type EngineState struct { TiltBuildInfo model.TiltBuild TiltStartTime time.Time // saved so that we can render in order ManifestDefinitionOrder []model.ManifestName // TODO(nick): This will eventually be a general Target index. ManifestTargets map[model.ManifestName]*ManifestTarget CurrentlyBuilding map[model.ManifestName]bool EngineMode EngineMode TerminalMode TerminalMode // For synchronizing BuildController -- wait until engine records all builds started // so far before starting another build StartedBuildCount int // How many builds have been completed (pass or fail) since starting tilt CompletedBuildCount int // For synchronizing ConfigsController -- wait until engine records all builds started // so far before starting another build StartedTiltfileLoadCount int UpdateSettings model.UpdateSettings FatalError error // The user has indicated they want to exit UserExited bool // We recovered from a panic(). We need to clean up the RTY and print the error. PanicExited error // Normal process termination. Either Tilt completed all its work, // or it determined that it was unable to complete the work it was assigned. // // Note that ExitSignal/ExitError is never triggered in normal // 'tilt up`/dev mode. It's more for CI modes and tilt up --watch=false modes. // // We don't provide the ability to customize exit codes. Either the // process exited successfully, or with an error. In the future, we might // add the ability to put an exit code in the error. ExitSignal bool ExitError error // All logs in Tilt, stored in a structured format. LogStore *logstore.LogStore `testdiff:"ignore"` TiltfilePath string // TODO(nick): This should be called "ConfigPaths", not "ConfigFiles", // because this could refer to directories that are watched recursively. ConfigFiles []string TiltIgnoreContents string PendingConfigFileChanges map[string]time.Time TriggerQueue []model.ManifestName IsProfiling bool TiltfileState ManifestState SuggestedTiltVersion string VersionSettings model.VersionSettings // Analytics Info AnalyticsEnvOpt analytics.Opt AnalyticsUserOpt analytics.Opt // changes to this field will propagate into the TiltAnalytics subscriber + we'll record them as user choice AnalyticsTiltfileOpt analytics.Opt // Set by the Tiltfile. Overrides the UserOpt. AnalyticsNudgeSurfaced bool // this flag is set the first time we show the analytics nudge to the user. Features map[string]bool Secrets model.SecretSet CloudAddress string Token token.Token TeamID string CloudStatus CloudStatus DockerPruneSettings model.DockerPruneSettings TelemetrySettings model.TelemetrySettings UserConfigState model.UserConfigState }
func NewState ¶
func NewState() *EngineState
func (*EngineState) AnalyticsEffectiveOpt ¶ added in v0.10.16
func (e *EngineState) AnalyticsEffectiveOpt() analytics.Opt
Merge analytics opt-in status from different sources. The Tiltfile opt-in takes precedence over the user opt-in.
func (*EngineState) AvailableBuildSlots ¶ added in v0.14.0
func (e *EngineState) AvailableBuildSlots() int
func (*EngineState) BuildStatus ¶ added in v0.5.1
func (e *EngineState) BuildStatus(id model.TargetID) BuildStatus
Find the first build status. Only suitable for testing.
func (EngineState) DockerComposeConfigPath ¶ added in v0.4.1
func (s EngineState) DockerComposeConfigPath() []string
DockerComposeConfigPath returns the path to the docker-compose yaml file of any docker-compose manifests on this EngineState. NOTE(maia): current assumption is only one d-c.yaml per run, so we take the path from the first d-c manifest we see.
func (*EngineState) HasDockerBuild ¶ added in v0.10.14
func (e *EngineState) HasDockerBuild() bool
func (*EngineState) InitialBuildsCompleted ¶ added in v0.10.18
func (e *EngineState) InitialBuildsCompleted() bool
func (*EngineState) IsCurrentlyBuilding ¶ added in v0.14.0
func (e *EngineState) IsCurrentlyBuilding(name model.ManifestName) bool
func (EngineState) IsEmpty ¶ added in v0.4.1
func (e EngineState) IsEmpty() bool
func (EngineState) LastTiltfileError ¶ added in v0.2.0
func (e EngineState) LastTiltfileError() error
func (EngineState) Manifest ¶ added in v0.5.0
func (e EngineState) Manifest(mn model.ManifestName) (model.Manifest, bool)
func (*EngineState) ManifestInTriggerQueue ¶ added in v0.10.18
func (e *EngineState) ManifestInTriggerQueue(mn model.ManifestName) bool
func (*EngineState) ManifestNamesForTargetID ¶ added in v0.7.11
func (e *EngineState) ManifestNamesForTargetID(id model.TargetID) []model.ManifestName
func (EngineState) ManifestState ¶ added in v0.5.0
func (e EngineState) ManifestState(mn model.ManifestName) (*ManifestState, bool)
func (EngineState) ManifestStates ¶
func (e EngineState) ManifestStates() []*ManifestState
Returns ManifestStates in a stable order
func (EngineState) Manifests ¶
func (e EngineState) Manifests() []model.Manifest
Returns Manifests in a stable order
func (EngineState) RelativeTiltfilePath ¶ added in v0.4.1
func (e EngineState) RelativeTiltfilePath() (string, error)
func (EngineState) Targets ¶ added in v0.5.0
func (e EngineState) Targets() []*ManifestTarget
Returns ManifestTargets in a stable order
func (EngineState) TargetsBesides ¶ added in v0.16.0
func (e EngineState) TargetsBesides(mn model.ManifestName) []*ManifestTarget
func (*EngineState) UpsertManifestTarget ¶ added in v0.5.0
func (e *EngineState) UpsertManifestTarget(mt *ManifestTarget)
type ErrorAction ¶ added in v0.7.11
type ErrorAction struct {
Error error
}
func NewErrorAction ¶ added in v0.7.11
func NewErrorAction(err error) ErrorAction
func (ErrorAction) Action ¶ added in v0.7.11
func (ErrorAction) Action()
type ImageBuildResult ¶ added in v0.10.14
type ImageBuildResult struct { // TODO(maia): it would make the most sense for the ImageBuildResult to know what it BUILT, and for us // to calculate the ClusterRef (if different from LocalRef) when we have to inject it, but // storing all the info on ImageBuildResult for now was the fastest/safest way to ship this. // Note: image tag is derived from a content-addressable digest. ImageLocalRef reference.NamedTagged // built image, as referenced from outside the cluster (in Dockerfile, docker push etc.) ImageClusterRef reference.NamedTagged // built image, as referenced from the cluster (in K8s YAML, etc.) // contains filtered or unexported fields }
func NewImageBuildResult ¶ added in v0.7.11
func NewImageBuildResult(id model.TargetID, localRef, clusterRef reference.NamedTagged) ImageBuildResult
For image targets.
func NewImageBuildResultSingleRef ¶ added in v0.14.0
func NewImageBuildResultSingleRef(id model.TargetID, ref reference.NamedTagged) ImageBuildResult
When localRef == ClusterRef
func (ImageBuildResult) BuildType ¶ added in v0.10.14
func (r ImageBuildResult) BuildType() model.BuildType
func (ImageBuildResult) Facets ¶ added in v0.10.16
func (r ImageBuildResult) Facets() []model.Facet
func (ImageBuildResult) TargetID ¶ added in v0.10.14
func (r ImageBuildResult) TargetID() model.TargetID
type K8sBuildResult ¶ added in v0.10.14
type K8sBuildResult struct { // The UIDs that we deployed to a Kubernetes cluster. DeployedUIDs []types.UID // Hashes of the pod template specs that we deployed to a Kubernetes cluster. PodTemplateSpecHashes []k8s.PodTemplateSpecHash AppliedEntitiesText string // contains filtered or unexported fields }
func (K8sBuildResult) BuildType ¶ added in v0.10.14
func (r K8sBuildResult) BuildType() model.BuildType
func (K8sBuildResult) Facets ¶ added in v0.10.16
func (r K8sBuildResult) Facets() []model.Facet
func (K8sBuildResult) TargetID ¶ added in v0.10.14
func (r K8sBuildResult) TargetID() model.TargetID
type K8sEventAction ¶ added in v0.8.10
type K8sEventAction struct { Event *v1.Event ManifestName model.ManifestName }
func NewK8sEventAction ¶ added in v0.8.10
func NewK8sEventAction(event *v1.Event, manifestName model.ManifestName) K8sEventAction
func (K8sEventAction) Action ¶ added in v0.8.10
func (K8sEventAction) Action()
func (K8sEventAction) ToLogAction ¶ added in v0.8.10
func (kEvt K8sEventAction) ToLogAction(mn model.ManifestName) LogAction
type K8sRuntimeState ¶ added in v0.10.5
type K8sRuntimeState struct { // The ancestor that we match pods against to associate them with this manifest. // If we deployed Pod YAML, this will be the Pod UID. // In many cases, this will be a Deployment UID. PodAncestorUID types.UID Pods map[k8s.PodID]*Pod LBs map[k8s.ServiceName]*url.URL DeployedUIDSet UIDSet // for the most recent successful deploy DeployedPodTemplateSpecHashSet PodTemplateSpecHashSet // for the most recent successful deploy LastReadyOrSucceededTime time.Time HasEverDeployedSuccessfully bool PodReadinessMode model.PodReadinessMode }
func NewK8sRuntimeState ¶ added in v0.10.5
func NewK8sRuntimeState(m model.Manifest) K8sRuntimeState
func NewK8sRuntimeStateWithPods ¶ added in v0.16.0
func NewK8sRuntimeStateWithPods(m model.Manifest, pods ...Pod) K8sRuntimeState
func (K8sRuntimeState) ContainsID ¶ added in v0.10.5
func (s K8sRuntimeState) ContainsID(id k8s.PodID) bool
func (K8sRuntimeState) HasEverBeenReadyOrSucceeded ¶ added in v0.14.0
func (s K8sRuntimeState) HasEverBeenReadyOrSucceeded() bool
func (K8sRuntimeState) HasOKPodTemplateSpecHash ¶ added in v0.10.19
func (s K8sRuntimeState) HasOKPodTemplateSpecHash(pod *v1.Pod) bool
func (K8sRuntimeState) MostRecentPod ¶ added in v0.10.5
func (s K8sRuntimeState) MostRecentPod() Pod
Get the "most recent pod" from the K8sRuntimeState. For most users, we believe there will be only one pod per manifest. So most of this time, this will return the only pod. And in other cases, it will return a reasonable, consistent default.
func (K8sRuntimeState) PodLen ¶ added in v0.10.5
func (s K8sRuntimeState) PodLen() int
func (K8sRuntimeState) PodList ¶ added in v0.10.5
func (s K8sRuntimeState) PodList() []Pod
func (K8sRuntimeState) RuntimeState ¶ added in v0.10.5
func (K8sRuntimeState) RuntimeState()
func (K8sRuntimeState) RuntimeStatus ¶ added in v0.14.0
func (s K8sRuntimeState) RuntimeStatus() model.RuntimeStatus
func (K8sRuntimeState) RuntimeStatusError ¶ added in v0.14.0
func (s K8sRuntimeState) RuntimeStatusError() error
type LiveUpdateBuildResult ¶ added in v0.10.14
type LiveUpdateBuildResult struct { // The ID of the container(s) that we live-updated in-place. // // The contents of the container have diverged from the image it's built on, // so we need to keep track of that. LiveUpdatedContainerIDs []container.ID // contains filtered or unexported fields }
func NewLiveUpdateBuildResult ¶ added in v0.10.0
func NewLiveUpdateBuildResult(id model.TargetID, containerIDs []container.ID) LiveUpdateBuildResult
For in-place container updates.
func (LiveUpdateBuildResult) BuildType ¶ added in v0.10.14
func (r LiveUpdateBuildResult) BuildType() model.BuildType
func (LiveUpdateBuildResult) Facets ¶ added in v0.10.16
func (r LiveUpdateBuildResult) Facets() []model.Facet
func (LiveUpdateBuildResult) TargetID ¶ added in v0.10.14
func (r LiveUpdateBuildResult) TargetID() model.TargetID
type LocalBuildResult ¶ added in v0.10.14
type LocalBuildResult struct {
// contains filtered or unexported fields
}
func NewLocalBuildResult ¶ added in v0.10.14
func NewLocalBuildResult(id model.TargetID) LocalBuildResult
func (LocalBuildResult) BuildType ¶ added in v0.10.14
func (r LocalBuildResult) BuildType() model.BuildType
func (LocalBuildResult) Facets ¶ added in v0.10.16
func (r LocalBuildResult) Facets() []model.Facet
func (LocalBuildResult) TargetID ¶ added in v0.10.14
func (r LocalBuildResult) TargetID() model.TargetID
type LocalRuntimeState ¶ added in v0.10.9
type LocalRuntimeState struct { Status model.RuntimeStatus HasSucceededAtLeastOnce bool PID int SpanID model.LogSpanID }
func (LocalRuntimeState) HasEverBeenReadyOrSucceeded ¶ added in v0.14.0
func (l LocalRuntimeState) HasEverBeenReadyOrSucceeded() bool
func (LocalRuntimeState) RuntimeState ¶ added in v0.10.9
func (LocalRuntimeState) RuntimeState()
func (LocalRuntimeState) RuntimeStatus ¶ added in v0.14.0
func (l LocalRuntimeState) RuntimeStatus() model.RuntimeStatus
func (LocalRuntimeState) RuntimeStatusError ¶ added in v0.14.0
func (l LocalRuntimeState) RuntimeStatusError() error
type LogAction ¶ added in v0.8.1
type LogAction struct {
// contains filtered or unexported fields
}
func NewGlobalLogAction ¶ added in v0.14.0
func NewLogAction ¶ added in v0.14.0
func (LogAction) ManifestName ¶ added in v0.14.0
func (le LogAction) ManifestName() model.ManifestName
type LogActionsFlag ¶ added in v0.2.0
type LogActionsFlag bool
type ManifestState ¶
type ManifestState struct { Name model.ManifestName BuildStatuses map[model.TargetID]*BuildStatus RuntimeState RuntimeState PendingManifestChange time.Time // The current build CurrentBuild model.BuildRecord LastSuccessfulDeployTime time.Time // The last `BuildHistoryLimit` builds. The most recent build is first in the slice. BuildHistory []model.BuildRecord // The container IDs that we've run a LiveUpdate on, if any. Their contents have // diverged from the image they are built on. If these container don't appear on // the pod, we've lost that state and need to rebuild. LiveUpdatedContainerIDs map[container.ID]bool // We detected stale code and are currently doing an image build NeedsRebuildFromCrash bool // If a pod had to be killed because it was crashing, we keep the old log // around for a little while so we can show it in the UX. CrashLog model.Log // If this manifest was changed, which config files led to the most recent change in manifest definition ConfigFilesThatCausedChange []string // If the build was manually triggered, record why. TriggerReason model.BuildReason }
func (*ManifestState) ActiveBuild ¶ added in v0.4.3
func (ms *ManifestState) ActiveBuild() model.BuildRecord
func (*ManifestState) AddCompletedBuild ¶ added in v0.4.1
func (ms *ManifestState) AddCompletedBuild(bs model.BuildRecord)
func (*ManifestState) BuildStatus ¶ added in v0.5.1
func (ms *ManifestState) BuildStatus(id model.TargetID) BuildStatus
func (*ManifestState) DCRuntimeState ¶ added in v0.10.5
func (ms *ManifestState) DCRuntimeState() dockercompose.State
func (*ManifestState) HasPendingChanges ¶ added in v0.4.1
func (ms *ManifestState) HasPendingChanges() (bool, time.Time)
Whether changes have been made to this Manifest's synced files or config since the last build.
Returns: bool: whether changes have been made Time: the time of the earliest change
func (*ManifestState) HasPendingChangesBeforeOrEqual ¶ added in v0.14.0
Like HasPendingChanges, but relative to a particular time.
func (*ManifestState) HasPendingDependencyChanges ¶ added in v0.15.2
func (ms *ManifestState) HasPendingDependencyChanges() bool
func (*ManifestState) HasPendingFileChanges ¶ added in v0.7.11
func (ms *ManifestState) HasPendingFileChanges() bool
func (*ManifestState) IsBuilding ¶ added in v0.14.0
func (ms *ManifestState) IsBuilding() bool
func (*ManifestState) IsDC ¶ added in v0.4.1
func (ms *ManifestState) IsDC() bool
func (*ManifestState) IsK8s ¶ added in v0.10.5
func (ms *ManifestState) IsK8s() bool
func (*ManifestState) K8sRuntimeState ¶ added in v0.10.5
func (ms *ManifestState) K8sRuntimeState() K8sRuntimeState
func (*ManifestState) LastBuild ¶
func (ms *ManifestState) LastBuild() model.BuildRecord
func (*ManifestState) LocalRuntimeState ¶ added in v0.14.0
func (ms *ManifestState) LocalRuntimeState() LocalRuntimeState
func (*ManifestState) MostRecentPod ¶ added in v0.2.0
func (ms *ManifestState) MostRecentPod() Pod
func (*ManifestState) MutableBuildStatus ¶ added in v0.5.1
func (ms *ManifestState) MutableBuildStatus(id model.TargetID) *BuildStatus
func (*ManifestState) PodWithID ¶ added in v0.10.19
func (ms *ManifestState) PodWithID(pid k8s.PodID) (*Pod, bool)
func (*ManifestState) StartedFirstBuild ¶ added in v0.2.0
func (ms *ManifestState) StartedFirstBuild() bool
func (*ManifestState) TargetID ¶ added in v0.4.3
func (ms *ManifestState) TargetID() model.TargetID
type ManifestTarget ¶ added in v0.5.0
type ManifestTarget struct { Manifest model.Manifest State *ManifestState }
func NewManifestTarget ¶ added in v0.5.0
func NewManifestTarget(m model.Manifest) *ManifestTarget
func (*ManifestTarget) Facets ¶ added in v0.10.16
func (t *ManifestTarget) Facets(secrets model.SecretSet) []model.Facet
func (*ManifestTarget) NextBuildReason ¶ added in v0.10.19
func (mt *ManifestTarget) NextBuildReason() model.BuildReason
func (ManifestTarget) Spec ¶ added in v0.5.0
func (t ManifestTarget) Spec() model.TargetSpec
func (ManifestTarget) Status ¶ added in v0.5.0
func (t ManifestTarget) Status() model.TargetStatus
type PanicAction ¶ added in v0.10.22
type PanicAction struct {
Err error
}
func (PanicAction) Action ¶ added in v0.10.22
func (PanicAction) Action()
type Pod ¶
type Pod struct { PodID k8s.PodID Namespace k8s.Namespace StartedAt time.Time Status string Phase v1.PodPhase // Error messages from the pod state if it's in an error state. StatusMessages []string // Set when we get ready to replace a pod. We may do the update in-place. UpdateStartTime time.Time // If a pod is being deleted, Kubernetes marks it as Running // until it actually gets removed. Deleting bool HasSynclet bool Containers []Container InitContainers []Container // We want to show the user # of restarts since some baseline time // i.e. Total Restarts - BaselineRestarts BaselineRestarts int Conditions []v1.PodCondition SpanID model.LogSpanID }
func (Pod) AllContainerPorts ¶ added in v0.10.0
func (Pod) AllContainerRestarts ¶ added in v0.10.0
func (Pod) AllContainers ¶ added in v0.14.0
func (Pod) AllContainersReady ¶ added in v0.10.0
func (Pod) VisibleContainerRestarts ¶ added in v0.10.8
type PodResetRestartsAction ¶ added in v0.10.8
type PodResetRestartsAction struct { PodID k8s.PodID ManifestName model.ManifestName VisibleRestarts int }
The user can indicate "yes, I know the pod restarted N times, stop showing me"
func NewPodResetRestartsAction ¶ added in v0.10.8
func NewPodResetRestartsAction(podID k8s.PodID, mn model.ManifestName, visibleRestarts int) PodResetRestartsAction
func (PodResetRestartsAction) Action ¶ added in v0.10.8
func (PodResetRestartsAction) Action()
type PodTemplateSpecHashSet ¶ added in v0.10.16
type PodTemplateSpecHashSet map[k8s.PodTemplateSpecHash]bool
func NewPodTemplateSpecHashSet ¶ added in v0.10.16
func NewPodTemplateSpecHashSet() PodTemplateSpecHashSet
func (PodTemplateSpecHashSet) Add ¶ added in v0.10.16
func (s PodTemplateSpecHashSet) Add(hashes ...k8s.PodTemplateSpecHash)
func (PodTemplateSpecHashSet) Contains ¶ added in v0.10.16
func (s PodTemplateSpecHashSet) Contains(hash k8s.PodTemplateSpecHash) bool
type RStore ¶ added in v0.2.0
type RStore interface { Dispatch(action Action) RLockState() EngineState RUnlockState() StateMutex() *sync.RWMutex }
Read-only store
type Reducer ¶ added in v0.1.0
type Reducer func(ctx context.Context, engineState *EngineState, action Action)
type RuntimeState ¶ added in v0.10.5
type RuntimeState interface { RuntimeState() // There are two types of resource dependencies: // - servers (Deployments) where what's important is that the server is running // - tasks (Jobs, local resources) where what's important is that the job completed // Currently, we don't try to distinguish between these two cases. // // In the future, it might make sense to check "IsBlocking()" or something, // and alter the behavior based on whether the underlying resource is a server // or a task. HasEverBeenReadyOrSucceeded() bool RuntimeStatus() model.RuntimeStatus // If the runtime status is in Error mode, // RuntimeStatusError() should report a reason. RuntimeStatusError() error }
type SetUpper ¶ added in v0.8.2
Some subscribers need to do SetUp or TearDown. Both hold the subscriber lock, so should return quickly.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
A central state store, modeled after the Reactive programming UX pattern. Terminology is borrowed liberally from Redux. These docs in particular are helpful: https://redux.js.org/introduction/threeprinciples https://redux.js.org/basics
func NewStore ¶
func NewStore(reducer Reducer, logActions LogActionsFlag) *Store
func NewStoreWithFakeReducer ¶ added in v0.14.0
Returns a Store with a fake reducer that saves observed actions and makes them available via the return value `getActions`.
Tests should only use this if they: 1) want to test the Store itself, or 2) want to test subscribers with the particular async behavior of a real Store Otherwise, use NewTestingStore().
func (*Store) AddSubscriber ¶
func (s *Store) AddSubscriber(ctx context.Context, sub Subscriber)
func (*Store) LockMutableStateForTesting ¶ added in v0.1.0
func (s *Store) LockMutableStateForTesting() *EngineState
func (*Store) NotifySubscribers ¶
Sends messages to all the subscribers asynchronously.
func (*Store) RLockState ¶
func (s *Store) RLockState() EngineState
TODO(nick): Clone the state to ensure it's not mutated. For now, we use RW locks to simulate the same behavior, but the onus is on the caller to RUnlockState.
func (*Store) RUnlockState ¶
func (s *Store) RUnlockState()
func (*Store) RemoveSubscriber ¶ added in v0.4.1
func (s *Store) RemoveSubscriber(ctx context.Context, sub Subscriber) error
func (*Store) SetUpSubscribersForTesting ¶ added in v0.8.2
func (*Store) StateMutex ¶ added in v0.10.24
func (*Store) UnlockMutableState ¶
func (s *Store) UnlockMutableState()
type Subscriber ¶
A subscriber is notified whenever the state changes.
Subscribers do not need to be thread-safe. The Store will only call OnChange for a given subscriber when the last call completes.
Subscribers are only allowed to read state. If they want to modify state, they should call store.Dispatch()
type SubscriberLifecycle ¶ added in v0.7.11
type SubscriberLifecycle interface { SetUpper TearDowner }
Convenience interface for subscriber fulfilling both SetUpper and TearDowner
type TearDowner ¶ added in v0.8.2
type TerminalMode ¶ added in v0.15.0
type TerminalMode int
When Tilt is talking to a terminal, it can take on a few different modes.
const ( // For the case where the terminal mode simply // hasn't been initialized yet. TerminalModeDefault TerminalMode = iota // A termbox UI takes over your terminal screen. TerminalModeHUD // Logs are incrementally written to stdout. // This is the only available mode if the user // is redirecting tilt output to a file. TerminalModeStream // Tilt waits on a prompt to decide what mode // to be in. TerminalModePrompt )
type TestingStore ¶ added in v0.2.0
type TestingStore struct {
// contains filtered or unexported fields
}
func NewTestingStore ¶ added in v0.2.0
func NewTestingStore() *TestingStore
func (*TestingStore) Actions ¶ added in v0.2.0
func (s *TestingStore) Actions() []Action
func (*TestingStore) AssertNoErrorActions ¶ added in v0.14.0
func (s *TestingStore) AssertNoErrorActions(t testing.TB)
func (*TestingStore) ClearActions ¶ added in v0.14.0
func (s *TestingStore) ClearActions()
func (*TestingStore) Dispatch ¶ added in v0.2.0
func (s *TestingStore) Dispatch(action Action)
func (*TestingStore) LockMutableStateForTesting ¶ added in v0.14.0
func (s *TestingStore) LockMutableStateForTesting() *EngineState
func (*TestingStore) RLockState ¶ added in v0.2.0
func (s *TestingStore) RLockState() EngineState
func (*TestingStore) RUnlockState ¶ added in v0.2.0
func (s *TestingStore) RUnlockState()
func (*TestingStore) SetState ¶ added in v0.2.0
func (s *TestingStore) SetState(state EngineState)
func (*TestingStore) StateMutex ¶ added in v0.10.24
func (s *TestingStore) StateMutex() *sync.RWMutex
func (*TestingStore) UnlockMutableState ¶ added in v0.14.0
func (s *TestingStore) UnlockMutableState()
func (*TestingStore) WaitForAction ¶ added in v0.15.0
func (*TestingStore) WithState ¶ added in v0.14.0
func (s *TestingStore) WithState(f func(state *EngineState))
type TiltCloudStatusReceivedAction ¶ added in v0.14.0
type TiltCloudStatusReceivedAction struct { Found bool Username string TeamName string IsPostRegistrationLookup bool SuggestedTiltVersion string }
func (TiltCloudStatusReceivedAction) Action ¶ added in v0.14.0
func (TiltCloudStatusReceivedAction) Action()
type UserStartedTiltCloudRegistrationAction ¶ added in v0.10.7
type UserStartedTiltCloudRegistrationAction struct{}
func (UserStartedTiltCloudRegistrationAction) Action ¶ added in v0.10.7
func (UserStartedTiltCloudRegistrationAction) Action()