Documentation ¶
Index ¶
- func GetTargets(filename string) ([]string, error)
- func ParseDebug(filename string) error
- type ArtifactBuilderFun
- type ConvertOpt
- type Converter
- func (c *Converter) Arg(ctx context.Context, argKey string, defaultArgValue string)
- func (c *Converter) Build(ctx context.Context, fullTargetName string, buildArgs []string) (*MultiTargetStates, error)
- func (c *Converter) Cmd(ctx context.Context, cmdArgs []string, isWithShell bool)
- func (c *Converter) CopyArtifact(ctx context.Context, artifactName string, dest string, buildArgs []string, ...) error
- func (c *Converter) CopyClassical(ctx context.Context, srcs []string, dest string, isDir bool, chown string)
- func (c *Converter) DockerLoadOld(ctx context.Context, targetName string, dockerTag string, buildArgs []string) error
- func (c *Converter) DockerPullOld(ctx context.Context, dockerTag string) error
- func (c *Converter) Entrypoint(ctx context.Context, entrypointArgs []string, isWithShell bool)
- func (c *Converter) Env(ctx context.Context, envKey string, envValue string)
- func (c *Converter) ExpandArgs(word string) string
- func (c *Converter) Expose(ctx context.Context, ports []string)
- func (c *Converter) FinalizeStates() *MultiTargetStates
- func (c *Converter) From(ctx context.Context, imageName string, buildArgs []string) error
- func (c *Converter) FromDockerfile(ctx context.Context, contextPath string, dfPath string, dfTarget string, ...) error
- func (c *Converter) GitClone(ctx context.Context, gitURL string, branch string, dest string) error
- func (c *Converter) Healthcheck(ctx context.Context, isNone bool, cmdArgs []string, interval time.Duration, ...)
- func (c *Converter) Label(ctx context.Context, labels map[string]string)
- func (c *Converter) Run(ctx context.Context, args []string, mounts []string, secretKeyValues []string, ...) error
- func (c *Converter) SaveArtifact(ctx context.Context, saveFrom string, saveTo string, saveAsLocalTo string) error
- func (c *Converter) SaveImage(ctx context.Context, imageNames []string, pushImages bool)
- func (c *Converter) User(ctx context.Context, user string)
- func (c *Converter) Volume(ctx context.Context, volumes []string)
- func (c *Converter) WithDockerRun(ctx context.Context, args []string, opt WithDockerOpt) error
- func (c *Converter) Workdir(ctx context.Context, workdirPath string)
- type DockerBuilderFun
- type DockerLoadOpt
- type MultiTargetStates
- type RunPush
- type SaveImage
- type SaveLocal
- type SingleTargetStates
- type StringSliceFlag
- type WithDockerOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTargets ¶ added in v0.3.2
GetTargets returns a list of targets from an Earthfile
func ParseDebug ¶
ParseDebug parses a earthfile and prints debug information about it.
Types ¶
type ArtifactBuilderFun ¶ added in v0.3.2
type ArtifactBuilderFun = func(ctx context.Context, mts *MultiTargetStates, artifact domain.Artifact, outFile string) error
ArtifactBuilderFun is a function able to build an artifact and output it locally.
type ConvertOpt ¶ added in v0.3.0
type ConvertOpt struct { // Resolver is the build context resolver. Resolver *buildcontext.Resolver // The resolve mode for referenced images (force pull or prefer local). ImageResolveMode llb.ResolveMode // DockerBuilderFun is a fun that can be used to execute an image build. This // is used as part of operations like DOCKER LOAD and DOCKER PULL, where // a tar image is needed in the middle of a build. DockerBuilderFun DockerBuilderFun // ArtifactBuilderFun is a fun that can be used to execute build of an artifact. // This is used as part of operations like FROM DOCKERFILE +.../..., where // a generated Dockerfile is needed in the middle of a build. ArtifactBuilderFun ArtifactBuilderFun // CleanCollection is a collection of cleanup functions. CleanCollection *cleanup.Collection // VisitedStates is a collection of target states which have been converted to LLB. // This is used for deduplication and infinite cycle detection. VisitedStates map[string][]*SingleTargetStates // VarCollection is a collection of build args used for overriding args in the build. VarCollection *variables.Collection // A cache for image solves. depTargetInputHash -> context containing image.tar. SolveCache map[string]llb.State }
ConvertOpt holds conversion parameters needed for conversion.
type Converter ¶
type Converter struct {
// contains filtered or unexported fields
}
Converter turns earth commands to buildkit LLB representation.
func NewConverter ¶
func NewConverter(ctx context.Context, target domain.Target, bc *buildcontext.Data, opt ConvertOpt) (*Converter, error)
NewConverter constructs a new converter for a given earth target.
func (*Converter) Build ¶
func (c *Converter) Build(ctx context.Context, fullTargetName string, buildArgs []string) (*MultiTargetStates, error)
Build applies the earth BUILD command.
func (*Converter) CopyArtifact ¶
func (c *Converter) CopyArtifact(ctx context.Context, artifactName string, dest string, buildArgs []string, isDir bool, chown string) error
CopyArtifact applies the earth COPY artifact command.
func (*Converter) CopyClassical ¶
func (c *Converter) CopyClassical(ctx context.Context, srcs []string, dest string, isDir bool, chown string)
CopyClassical applies the earth COPY command, with classical args.
func (*Converter) DockerLoadOld ¶ added in v0.3.2
func (c *Converter) DockerLoadOld(ctx context.Context, targetName string, dockerTag string, buildArgs []string) error
DockerLoadOld applies the DOCKER LOAD command (outside of WITH DOCKER).
func (*Converter) DockerPullOld ¶ added in v0.3.2
DockerPullOld applies the DOCKER PULL command (outside of WITH DOCKER).
func (*Converter) Entrypoint ¶
Entrypoint applies the ENTRYPOINT command.
func (*Converter) ExpandArgs ¶ added in v0.3.3
ExpandArgs expands args in the provided word.
func (*Converter) FinalizeStates ¶
func (c *Converter) FinalizeStates() *MultiTargetStates
FinalizeStates returns the LLB states.
func (*Converter) FromDockerfile ¶ added in v0.3.0
func (c *Converter) FromDockerfile(ctx context.Context, contextPath string, dfPath string, dfTarget string, buildArgs []string) error
FromDockerfile applies the earth FROM DOCKERFILE command.
func (*Converter) Healthcheck ¶ added in v0.2.0
func (c *Converter) Healthcheck(ctx context.Context, isNone bool, cmdArgs []string, interval time.Duration, timeout time.Duration, startPeriod time.Duration, retries int)
Healthcheck applies the HEALTHCHECK command.
func (*Converter) Run ¶
func (c *Converter) Run(ctx context.Context, args []string, mounts []string, secretKeyValues []string, privileged bool, withEntrypoint bool, withDocker bool, isWithShell bool, pushFlag bool) error
Run applies the earth RUN command.
func (*Converter) SaveArtifact ¶
func (c *Converter) SaveArtifact(ctx context.Context, saveFrom string, saveTo string, saveAsLocalTo string) error
SaveArtifact applies the earth SAVE ARTIFACT command.
func (*Converter) WithDockerRun ¶ added in v0.3.2
WithDockerRun applies an entire WITH DOCKER ... RUN ... END clause.
type DockerBuilderFun ¶
type DockerBuilderFun = func(ctx context.Context, mts *MultiTargetStates, dockerTag string, outFile string) error
DockerBuilderFun is a function able to build a target into a docker tar file.
type DockerLoadOpt ¶ added in v0.3.2
DockerLoadOpt holds parameters for DOCKER LOAD commands.
type MultiTargetStates ¶
type MultiTargetStates struct { // VisitedStates represents the previously visited states, grouped by target // name. Duplicate targets are possible if same target is called with different // build args. VisitedStates map[string][]*SingleTargetStates // FinalStates is the main target to be built. FinalStates *SingleTargetStates }
MultiTargetStates holds LLB states representing multiple earth targets, in the order in which they should be built.
func Earthfile2LLB ¶
func Earthfile2LLB(ctx context.Context, target domain.Target, opt ConvertOpt) (mts *MultiTargetStates, err error)
Earthfile2LLB parses a earthfile and executes the statements for a given target.
func (*MultiTargetStates) AllStates ¶
func (mts *MultiTargetStates) AllStates() []*SingleTargetStates
AllStates returns all SingleTargetStates contained within.
func (*MultiTargetStates) FinalTarget ¶
func (mts *MultiTargetStates) FinalTarget() domain.Target
FinalTarget returns the final target of the states.
type RunPush ¶
RunPush is a series of RUN --push commands to be run after the build has been deemed as successful.
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 }
SaveLocal is an artifact path to be saved to local disk.
type SingleTargetStates ¶
type SingleTargetStates struct { Target domain.Target TargetInput dedup.TargetInput SideEffectsImage *image.Image SideEffectsState llb.State ArtifactsState llb.State SeparateArtifactsState []llb.State SaveLocals []SaveLocal SaveImages []SaveImage RunPush RunPush LocalDirs map[string]string Ongoing bool Salt string }
SingleTargetStates holds LLB states representing a earth target.
func (*SingleTargetStates) LastSaveImage ¶
func (sts *SingleTargetStates) LastSaveImage() (SaveImage, bool)
LastSaveImage returns the last save image available (if any).
type StringSliceFlag ¶
type StringSliceFlag struct {
Args []string
}
StringSliceFlag is a flag backed by a string slice.
func (*StringSliceFlag) Set ¶
func (ssf *StringSliceFlag) Set(arg string) error
Set adds a flag value to the string slice.
func (*StringSliceFlag) String ¶
func (ssf *StringSliceFlag) String() string
String returns a string representation of the flag.
type WithDockerOpt ¶ added in v0.3.2
type WithDockerOpt struct { Mounts []string Secrets []string WithShell bool WithEntrypoint bool Pulls []string Loads []DockerLoadOpt }
WithDockerOpt holds parameters for WITH DOCKER run.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package imr is based on github.com/moby/buildkit/client/llb/imagemetaresolver, except that it applies a docker authorizer, which uses the standard docker credentials already available on the system.
|
Package imr is based on github.com/moby/buildkit/client/llb/imagemetaresolver, except that it applies a docker authorizer, which uses the standard docker credentials already available on the system. |