tiltfile

package
v0.33.13 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const TiltfileBuildSource = "tiltfile"

Variables

View Source
var WireSet = wire.NewSet(
	NewReconciler,
)

Functions

func HandleConfigsReloadStarted added in v0.22.6

func HandleConfigsReloadStarted(
	ctx context.Context,
	state *store.EngineState,
	event ConfigsReloadStartedAction,
)

func HandleConfigsReloaded added in v0.22.6

func HandleConfigsReloaded(
	ctx context.Context,
	state *store.EngineState,
	event ConfigsReloadedAction,
)

In the original Tilt architecture, the Tiltfile contained the whole engine state. Reloading the tiltfile re-created that state from scratch.

We've moved towards a more modular architecture, but many of the tilt data models aren't modular. For example, if two Tiltfiles set UpdateSettings, it's not clear which one "wins" or how their preferences combine.

In the long-term, Tiltfile settings should only take affect in objects created by that Tiltfile. (e.g., WatchSettings only affects FileWatches created by that Tiltfile.)

In the medium-term, we resolve this in the EngineState in three different ways:

  1. If a data structure supports merging (like the Manifest map), do a merge.
  2. If merging fails (like if two Tiltfiles define the same Manifest), log an Error and try to do something reasonable.
  3. If a data structure does not support merging (like UpdateSettings), only accept that data structure from the "main" tiltfile.

func SpanIDForLoadCount added in v0.22.4

func SpanIDForLoadCount(mn model.ManifestName, loadCount int) logstore.SpanID

func ToFileWatchObjects added in v0.22.4

func ToFileWatchObjects(watchInputs WatchInputs, disableSources map[model.ManifestName]*v1alpha1.DisableSource) apiset.TypedObjectSet

Create FileWatch specs from Tilt manifests in the engine state.

Types

type BuildEntry added in v0.22.4

type BuildEntry struct {
	Name                  model.ManifestName
	FilesChanged          []string
	BuildReason           model.BuildReason
	Args                  []string
	TiltfilePath          string
	CheckpointAtExecStart logstore.Checkpoint
	LoadCount             int
	ArgsChanged           bool
}

BuildEntry is vestigial, but currently used to help manage state about a tiltfile build.

func (*BuildEntry) WithLogger added in v0.22.4

func (be *BuildEntry) WithLogger(ctx context.Context, st store.RStore) context.Context

type ConfigsReloadStartedAction added in v0.22.4

type ConfigsReloadStartedAction struct {
	Name         model.ManifestName
	FilesChanged []string
	StartTime    time.Time
	SpanID       logstore.SpanID
	Reason       model.BuildReason
}

func (ConfigsReloadStartedAction) Action added in v0.22.4

func (ConfigsReloadStartedAction) Action()

type ConfigsReloadedAction added in v0.22.4

type ConfigsReloadedAction struct {
	Name model.ManifestName

	// TODO(nick): Embed TiltfileLoadResult instead of copying fields.
	Manifests   []model.Manifest
	Tiltignore  model.Dockerignore
	ConfigFiles []string

	FinishTime           time.Time
	Err                  error
	Warnings             []string
	Features             map[string]bool
	TeamID               string
	TelemetrySettings    model.TelemetrySettings
	Secrets              model.SecretSet
	DockerPruneSettings  model.DockerPruneSettings
	AnalyticsTiltfileOpt analytics.Opt
	VersionSettings      model.VersionSettings
	UpdateSettings       model.UpdateSettings
	WatchSettings        model.WatchSettings

	// A checkpoint into the logstore when Tiltfile execution started.
	// Useful for knowing how far back in time we have to scrub secrets.
	CheckpointAtExecStart logstore.Checkpoint
}

func (ConfigsReloadedAction) Action added in v0.22.4

func (ConfigsReloadedAction) Action()

type Reconciler

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

func NewReconciler

func NewReconciler(
	st store.RStore,
	tfl tiltfile.TiltfileLoader,
	dockerClient docker.Client,
	ctrlClient ctrlclient.Client,
	scheme *runtime.Scheme,
	engineMode store.EngineMode,
	k8sContextOverride k8s.KubeContextOverride,
	k8sNamespaceOverride k8s.NamespaceOverride,
	ciTimeoutFlag model.CITimeoutFlag,
) *Reconciler

func (*Reconciler) CreateBuilder

func (r *Reconciler) CreateBuilder(mgr ctrl.Manager) (*builder.Builder, error)

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)

Reconcile manages Tiltfile execution.

type WatchInputs added in v0.22.4

type WatchInputs struct {
	TiltfileManifestName model.ManifestName
	TiltfilePath         string
	Manifests            []model.Manifest
	ConfigFiles          []string
	WatchSettings        model.WatchSettings
	Tiltignore           model.Dockerignore
	EngineMode           store.EngineMode
}

type WatchableTarget added in v0.22.4

type WatchableTarget interface {
	GetFileWatchIgnores() []v1alpha1.IgnoreDef
	Dependencies() []string
	ID() model.TargetID
}

Jump to

Keyboard shortcuts

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