buildcontrol

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func BuildTargets added in v0.19.5

func BuildTargets(manifest model.Manifest) []model.TargetSpec

Extract target specs from a manifest for BuildAndDeploy.

func EarliestPendingAutoTriggerTarget

func EarliestPendingAutoTriggerTarget(targets []*store.ManifestTarget) *store.ManifestTarget

Go through all the manifests, and check: 1) all pending file changes 2) all pending dependency changes (where an image has been rebuilt by another manifest), and 3) all pending manifest changes The earliest one is the one we want.

If no targets are pending, return nil

func FindDeployOnlyK8sManifestTargets

func FindDeployOnlyK8sManifestTargets(targets []*store.ManifestTarget) []*store.ManifestTarget

func FindLocalTargets

func FindLocalTargets(targets []*store.ManifestTarget) []*store.ManifestTarget

func FindTargetsNeedingInitialBuild added in v0.10.18

func FindTargetsNeedingInitialBuild(targets []*store.ManifestTarget) []*store.ManifestTarget

func FindUnresourcedYAML

func FindUnresourcedYAML(targets []*store.ManifestTarget) *store.ManifestTarget

func HasFileChangesTree added in v0.19.5

func HasFileChangesTree(g model.TargetGraph, target model.TargetSpec, stateSet store.BuildStateSet) ([]model.TargetID, error)

Given a target, return all the target IDs in its tree of dependencies that have changed files.

func HoldDisabledTargets added in v0.22.14

func HoldDisabledTargets(state store.EngineState, mts []*store.ManifestTarget, holds HoldSet)

func HoldK8sTargets added in v0.17.5

func HoldK8sTargets(targets []*store.ManifestTarget, holds HoldSet)

func HoldLiveUpdateTargetsHandledByReconciler added in v0.23.0

func HoldLiveUpdateTargetsHandledByReconciler(state store.EngineState, mts []*store.ManifestTarget, holds HoldSet)

Hold back live update targets that are being successfully handled by a reconciler.

func HoldLiveUpdateTargetsWaitingOnDeploy added in v0.17.5

func HoldLiveUpdateTargetsWaitingOnDeploy(state store.EngineState, mts []*store.ManifestTarget, holds HoldSet)

func HoldTargetsWaitingOnDependencies added in v0.17.5

func HoldTargetsWaitingOnDependencies(state store.EngineState, mts []*store.ManifestTarget, holds HoldSet)

func HoldTargetsWithBuildingComponents added in v0.17.5

func HoldTargetsWithBuildingComponents(mts []*store.ManifestTarget, holds HoldSet)

func HoldUnparallelizableLocalTargets added in v0.17.5

func HoldUnparallelizableLocalTargets(targets []*store.ManifestTarget, holds map[model.ManifestName]store.Hold)

func InjectImageDependencies added in v0.19.5

func InjectImageDependencies(iTarget model.ImageTarget, iTargetMap map[model.TargetID]model.ImageTarget, deps []store.ImageBuildResult) (model.ImageTarget, error)

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

func IsBuildingAnything added in v0.14.0

func IsBuildingAnything(state store.EngineState) bool

func IsBuildingUncategorizedYAML added in v0.16.0

func IsBuildingUncategorizedYAML(state store.EngineState) bool

func IsBuildingUnparallelizableLocalTarget added in v0.17.2

func IsBuildingUnparallelizableLocalTarget(state store.EngineState) (model.ManifestName, model.TargetName, bool)

func IsDontFallBackError added in v0.10.25

func IsDontFallBackError(err error) bool

func IsImageDeployedToDC added in v0.19.5

func IsImageDeployedToDC(iTarget model.ImageTarget, dcTarget model.DockerComposeTarget) bool

Returns true if the given image is deployed to one of the given docker-compose targets. Note that some images are injected into other images, so may never be deployed.

func IsImageDeployedToK8s added in v0.19.5

func IsImageDeployedToK8s(iTarget model.ImageTarget, kTarget model.K8sTarget) bool

Returns true if the given image is deployed to one of the given k8s targets. Note that some images are injected into other images, so may never be deployed.

func IsLiveUpdateTargetWaitingOnDeploy added in v0.17.5

func IsLiveUpdateTargetWaitingOnDeploy(state store.EngineState, mt *store.ManifestTarget) bool

func NextManifestNameToBuild

func NextManifestNameToBuild(state store.EngineState) model.ManifestName

func NextUnbuiltTargetToBuild

func NextUnbuiltTargetToBuild(unbuilt []*store.ManifestTarget) *store.ManifestTarget

Helper function for ordering targets that have never been built before.

func ShouldFallBackForErr added in v0.10.25

func ShouldFallBackForErr(err error) bool

func WrapDontFallBackError added in v0.10.25

func WrapDontFallBackError(err error) error

Types

type BuildAndDeployer added in v0.19.5

type BuildAndDeployer interface {

	// Returns a BuildResultSet containing output (build result and associated
	// file changes) for each target built in this call. The BuildResultSet only
	// contains results for newly built targets--if a target was clean and didn't
	// need to be built, it doesn't appear in the result set.
	//
	// BuildResult can be used to construct a set of BuildStates, which contain
	// the last successful builds of each target and the files changed since that
	// build.
	BuildAndDeploy(ctx context.Context, st store.RStore, specs []model.TargetSpec, currentState store.BuildStateSet) (store.BuildResultSet, error)
}

type BuildHandler added in v0.14.0

type BuildHandler func(
	target model.TargetSpec,
	depResults []store.ImageBuildResult) (store.ImageBuildResult, error)

Allows the caller to inject its own build strategy for dirty targets.

type DockerComposeBuildAndDeployer added in v0.19.5

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

func NewDockerComposeBuildAndDeployer added in v0.19.5

func NewDockerComposeBuildAndDeployer(dcc dockercompose.DockerComposeClient, dc docker.Client,
	ib *ImageBuilder, c build.Clock) *DockerComposeBuildAndDeployer

func ProvideDockerComposeBuildAndDeployer added in v0.19.5

func ProvideDockerComposeBuildAndDeployer(ctx context.Context, dcCli dockercompose.DockerComposeClient, dCli docker.Client, dir *dirs.TiltDevDir) (*DockerComposeBuildAndDeployer, error)

func (*DockerComposeBuildAndDeployer) BuildAndDeploy added in v0.19.5

func (bd *DockerComposeBuildAndDeployer) BuildAndDeploy(ctx context.Context, st store.RStore, specs []model.TargetSpec, currentState store.BuildStateSet) (res store.BuildResultSet, err error)

type DontFallBackError added in v0.10.25

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

Something is wrong enough that we shouldn't bother falling back to other BaD's -- they won't work.

func DontFallBackErrorf added in v0.10.25

func DontFallBackErrorf(msg string, a ...interface{}) DontFallBackError

type HoldSet added in v0.17.5

type HoldSet map[model.ManifestName]store.Hold

func NextTargetToBuild

func NextTargetToBuild(state store.EngineState) (*store.ManifestTarget, HoldSet)

Algorithm to choose a manifest to build next.

func (HoldSet) AddHold added in v0.17.5

func (s HoldSet) AddHold(target *store.ManifestTarget, hold store.Hold)

func (HoldSet) Fill added in v0.17.5

func (s HoldSet) Fill(targets []*store.ManifestTarget, hold store.Hold)

For all the targets that should have built and don't have a prior Hold, add the given Hold.

func (HoldSet) IsEligible added in v0.22.14

func (s HoldSet) IsEligible(target *store.ManifestTarget) bool

func (HoldSet) RemoveIneligibleTargets added in v0.17.5

func (s HoldSet) RemoveIneligibleTargets(targets []*store.ManifestTarget) []*store.ManifestTarget

type ImageBuildAndDeployer added in v0.19.5

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

func NewImageBuildAndDeployer added in v0.19.5

func NewImageBuildAndDeployer(
	db build.DockerBuilder,
	customBuilder build.CustomBuilder,
	k8sClient k8s.Client,
	env k8s.Env,
	kubeContext k8s.KubeContext,
	analytics *analytics.TiltAnalytics,
	c build.Clock,
	kl KINDLoader,
	ctrlClient ctrlclient.Client,
	r *kubernetesapply.Reconciler,
) *ImageBuildAndDeployer

func ProvideImageBuildAndDeployer added in v0.19.5

func ProvideImageBuildAndDeployer(ctx context.Context, docker2 docker.Client, kClient k8s.Client, env k8s.Env, kubeContext k8s.KubeContext, clusterEnv docker.ClusterEnv, dir *dirs.TiltDevDir, clock build.Clock, kp KINDLoader, analytics2 *analytics.TiltAnalytics, ctrlclient client.Client, st store.RStore, execer localexec.Execer) (*ImageBuildAndDeployer, error)

func (*ImageBuildAndDeployer) BuildAndDeploy added in v0.19.5

func (ibd *ImageBuildAndDeployer) BuildAndDeploy(ctx context.Context, st store.RStore, specs []model.TargetSpec, stateSet store.BuildStateSet) (resultSet store.BuildResultSet, err error)

type ImageBuilder added in v0.19.5

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

func NewImageBuilder added in v0.19.5

func NewImageBuilder(db build.DockerBuilder, custb build.CustomBuilder) *ImageBuilder

func (*ImageBuilder) Build added in v0.19.5

func (icb *ImageBuilder) Build(ctx context.Context, iTarget model.ImageTarget,
	ps *build.PipelineState) (refs container.TaggedRefs, err error)

func (*ImageBuilder) CanReuseRef added in v0.19.5

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

type KINDLoader added in v0.19.5

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

func NewKINDLoader added in v0.19.5

func NewKINDLoader(env k8s.Env, clusterName k8s.ClusterName) KINDLoader

type LiveUpdateBuildAndDeployer added in v0.19.5

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

func NewLiveUpdateBuildAndDeployer added in v0.19.5

func NewLiveUpdateBuildAndDeployer(luReconciler *ctrlliveupdate.Reconciler, c build.Clock) *LiveUpdateBuildAndDeployer

func (*LiveUpdateBuildAndDeployer) BuildAndDeploy added in v0.19.5

func (lubad *LiveUpdateBuildAndDeployer) BuildAndDeploy(ctx context.Context, st store.RStore, specs []model.TargetSpec, stateSet store.BuildStateSet) (store.BuildResultSet, error)

type LiveUpdateInput added in v0.22.12

type LiveUpdateInput struct {
	ID model.TargetID

	// LiveUpdate API object name.
	Name string

	Spec v1alpha1.LiveUpdateSpec

	ctrlliveupdate.Input
}

Info needed to perform a live update

func (LiveUpdateInput) Empty added in v0.22.12

func (lui LiveUpdateInput) Empty() bool

type LocalTargetBuildAndDeployer added in v0.19.5

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

TODO(maia): CommandRunner interface for testability

func NewLocalTargetBuildAndDeployer added in v0.19.5

func NewLocalTargetBuildAndDeployer(
	c build.Clock,
	ctrlClient ctrlclient.Client,
	cmds *cmd.Controller) *LocalTargetBuildAndDeployer

func (*LocalTargetBuildAndDeployer) BuildAndDeploy added in v0.19.5

func (bd *LocalTargetBuildAndDeployer) BuildAndDeploy(ctx context.Context, st store.RStore, specs []model.TargetSpec, stateSet store.BuildStateSet) (resultSet store.BuildResultSet, err error)

type RedirectToNextBuilder added in v0.10.25

type RedirectToNextBuilder struct {
	Level logger.Level
	// contains filtered or unexported fields
}

Nothing is on fire, this is an expected case like a container builder being passed a build with no attached container. `level` indicates at what log level this error should be shown to the user

func RedirectToNextBuilderInfof added in v0.10.25

func RedirectToNextBuilderInfof(msg string, a ...interface{}) RedirectToNextBuilder

func SilentRedirectToNextBuilderf added in v0.10.25

func SilentRedirectToNextBuilderf(msg string, a ...interface{}) RedirectToNextBuilder

func WrapRedirectToNextBuilder added in v0.10.25

func WrapRedirectToNextBuilder(err error, level logger.Level) RedirectToNextBuilder

func (RedirectToNextBuilder) UserFacing added in v0.14.0

func (redir RedirectToNextBuilder) UserFacing() bool

UserFacing indicates whether this error should be messaged to the user by default. Should be `true` for messages we always want the user to read, e.g. "couldn't Live Update because we matched a fall_back_on file".

type ReuseRefChecker added in v0.16.0

type ReuseRefChecker func(ctx context.Context, iTarget model.ImageTarget, namedTagged reference.NamedTagged) (bool, error)

type TargetQueue added in v0.14.0

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

A little data structure to help iterate through dirty targets in dependency order.

func NewImageTargetQueue added in v0.14.0

func NewImageTargetQueue(ctx context.Context, iTargets []model.ImageTarget, state store.BuildStateSet, canReuseRef ReuseRefChecker) (*TargetQueue, error)

func (*TargetQueue) AllResults added in v0.14.1

func (q *TargetQueue) AllResults() store.ImageBuildResultSet

All results for targets in the current queue.

func (*TargetQueue) CountBuilds added in v0.14.1

func (q *TargetQueue) CountBuilds() int

func (*TargetQueue) NewResults added in v0.14.1

func (q *TargetQueue) NewResults() store.ImageBuildResultSet

New results that were built with the current queue. Omits results that were re-used previous builds.

Returns results that the BuildAndDeploy contract expects.

func (*TargetQueue) ReusedResults added in v0.14.1

func (q *TargetQueue) ReusedResults() store.ImageBuildResultSet

Reused results that were not built with the current queue.

Used for printing out which builds are cached from previous builds.

func (*TargetQueue) RunBuilds added in v0.14.0

func (q *TargetQueue) RunBuilds(handler BuildHandler) error

Jump to

Keyboard shortcuts

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