states

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerBuilderFun

type DockerBuilderFun = func(ctx context.Context, mts *MultiTarget, dockerTag string, outFile string) error

DockerBuilderFun is a function able to build a target into a docker tar file.

type MultiTarget

type MultiTarget struct {
	// Visited represents the previously visited states, grouped by target
	// name. Duplicate targets are possible if same target is called with different
	// build args.
	Visited *VisitedCollection
	// Final is the main target to be built.
	Final *SingleTarget
}

MultiTarget holds LLB states representing multiple earthly targets, in the order in which they should be built.

func (*MultiTarget) All

func (mts *MultiTarget) All() []*SingleTarget

All returns all SingleTarget contained within.

func (*MultiTarget) FinalTarget

func (mts *MultiTarget) FinalTarget() domain.Target

FinalTarget returns the final target of the states.

type RunPush

type RunPush struct {
	Initialized bool
	CommandStrs []string
	State       llb.State
}

RunPush is a series of RUN --push commands to be run after the build has been deemed as successful.

type SaveImage

type SaveImage struct {
	State        llb.State
	Image        *image.Image
	DockerTag    string
	Push         bool
	InsecurePush bool
	// CacheHint instructs Earthly to save a separate ref for this image, even if no tag is
	// provided.
	CacheHint bool
}

SaveImage is a docker image to be saved.

type SaveLocal

type SaveLocal struct {
	// DestPath is the local dest path to copy the artifact to.
	DestPath string
	// ArtifactPath is the relative path within the artifacts image.
	ArtifactPath string
	// Index is the index number of the "save as local" command encountered. Starts as 0.
	Index int
	// IfExists allows the artifact to be optional.
	IfExists bool
}

SaveLocal is an artifact path to be saved to local disk.

type SingleTarget

type SingleTarget struct {
	Target                 domain.Target
	Platform               *specs.Platform
	TargetInput            dedup.TargetInput
	MainImage              *image.Image
	MainState              llb.State
	ArtifactsState         llb.State
	SeparateArtifactsState []llb.State
	SaveLocals             []SaveLocal
	SaveImages             []SaveImage
	VarCollection          *variables.Collection
	RunPush                RunPush
	LocalDirs              map[string]string
	Ongoing                bool
	Salt                   string
	// HasDangling represents whether the target has dangling instructions -
	// ie if there are any non-SAVE commands after the first SAVE command,
	// or if the target is invoked via BUILD command (not COPY nor FROM).
	HasDangling bool
}

SingleTarget holds LLB states representing an earthly target.

func (*SingleTarget) LastSaveImage

func (sts *SingleTarget) LastSaveImage() SaveImage

LastSaveImage returns the last save image available (if any).

type SolveCache added in v0.4.4

type SolveCache map[StateKey]llb.State

SolveCache is a formal version of the cache we keep mapping targets to their LLB state.

func NewSolveCache added in v0.4.4

func NewSolveCache() *SolveCache

NewSolveCache gives a new SolveCachemap instance

func (*SolveCache) Delete added in v0.4.4

func (sc *SolveCache) Delete(sk StateKey, state llb.State)

Delete removes a LLB state from a given solve cache, using the KeyFunc to derive the key

func (*SolveCache) Get added in v0.4.4

func (sc *SolveCache) Get(sk StateKey) (llb.State, bool)

Get gets a LLB state out of a given solve cache, using the KeyFunc to derive the key

func (*SolveCache) Set added in v0.4.4

func (sc *SolveCache) Set(sk StateKey, state llb.State)

Set puts a LLB state in a given solve cache, using the KeyFunc to derive the key

type StateKey added in v0.4.4

type StateKey string

StateKey is a type for a key in SolveCache. These keys seem to be highly convention based, and used elsewhere too (LocalFolders?). so this is a step atformalizing that convention, since we sometimes need one key, and sometimes another. It may give us some toeholds to help with some refactoring later.

func KeyFromHashAndTag added in v0.4.4

func KeyFromHashAndTag(target *SingleTarget, dockerTag string) (StateKey, error)

KeyFromHashAndTag builds a state key from a given target state and a docker tag. This is useful when you want to reference the same image but with a different name.

func KeyFromState added in v0.4.4

func KeyFromState(target *SingleTarget) (StateKey, error)

KeyFromState is a simple wrapper to get a key from a given state using the hash of its target.

type VisitedCollection added in v0.3.12

type VisitedCollection struct {
	Visited map[string][]*SingleTarget
	// Same collection as above, but as a list, to make the ordering consistent.
	VisitedList []*SingleTarget
}

VisitedCollection is a collection of visited targets.

func NewVisitedCollection added in v0.3.12

func NewVisitedCollection() *VisitedCollection

NewVisitedCollection returns a collection of visited targets.

func (*VisitedCollection) Add added in v0.3.12

func (vc *VisitedCollection) Add(target string, sts *SingleTarget)

Add adds a target to the collection.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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