Documentation ¶
Index ¶
- func Earthfile2LLB(ctx context.Context, target domain.Target, opt ConvertOpt) (mts *states.MultiTarget, err error)
- func GetTargets(filename string) ([]string, error)
- func ParseDebug(filename string) error
- type ConvertOpt
- type Converter
- func (c *Converter) Arg(ctx context.Context, argKey string, defaultArgValue string, global bool)
- func (c *Converter) Build(ctx context.Context, fullTargetName string, platform *specs.Platform, ...) error
- func (c *Converter) Cmd(ctx context.Context, cmdArgs []string, isWithShell bool)
- func (c *Converter) CopyArtifact(ctx context.Context, artifactName string, dest string, ...) error
- func (c *Converter) CopyClassical(ctx context.Context, srcs []string, dest string, isDir bool, keepTs bool, ...)
- 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(ctx context.Context) (*states.MultiTarget, error)
- func (c *Converter) From(ctx context.Context, imageName string, platform *specs.Platform, ...) 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, keepTs bool) 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) Locally(ctx context.Context, platform *specs.Platform) error
- func (c *Converter) Run(ctx context.Context, args, mounts, secretKeyValues []string, ...) error
- func (c *Converter) RunLocal(ctx context.Context, args []string, pushFlag bool) 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, insecurePush bool, ...) error
- 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 DockerLoadOpt
- type DockerPullOpt
- type StringSliceFlag
- type WithDockerOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Earthfile2LLB ¶
func Earthfile2LLB(ctx context.Context, target domain.Target, opt ConvertOpt) (mts *states.MultiTarget, err error)
Earthfile2LLB parses a earthfile and executes the statements for a given target.
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 ConvertOpt ¶ added in v0.3.0
type ConvertOpt struct { // GwClient is the BuildKit gateway client. GwClient gwclient.Client // 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 states.DockerBuilderFun // CleanCollection is a collection of cleanup functions. CleanCollection *cleanup.Collection // Visited is a collection of target states which have been converted to LLB. // This is used for deduplication and infinite cycle detection. Visited *states.VisitedCollection // Platform is the target platform of the build. Platform *specs.Platform // VarCollection is a collection of build args used for overriding args in the build. VarCollection *variables.Collection // A cache for image solves. (maybe dockerTag +) depTargetInputHash -> context containing image.tar. SolveCache *states.SolveCache // BuildContextProvider is the provider used for local build context files. BuildContextProvider *provider.BuildContextProvider // MetaResolver is the image meta resolver to use for resolving image metadata. MetaResolver llb.ImageMetaResolver // CacheImports is a set of docker tags that can be used to import cache. Note that this // set is modified by the converter if InlineCache is enabled. CacheImports map[string]bool // UseInlineCache enables the inline caching feature (use any SAVE IMAGE --push declaration as // cache import). UseInlineCache bool // UseFakeDep is an internal feature flag for fake dep. UseFakeDep bool }
ConvertOpt holds conversion parameters needed for conversion.
type Converter ¶
type Converter struct {
// contains filtered or unexported fields
}
Converter turns earthly 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 earthly target.
func (*Converter) Build ¶
func (c *Converter) Build(ctx context.Context, fullTargetName string, platform *specs.Platform, buildArgs []string) error
Build applies the earthly BUILD command.
func (*Converter) CopyArtifact ¶
func (c *Converter) CopyArtifact(ctx context.Context, artifactName string, dest string, platform *specs.Platform, buildArgs []string, isDir bool, keepTs bool, keepOwn bool, chown string, ifExists bool) error
CopyArtifact applies the earthly COPY artifact command.
func (*Converter) CopyClassical ¶
func (c *Converter) CopyClassical(ctx context.Context, srcs []string, dest string, isDir bool, keepTs bool, keepOwn bool, chown string)
CopyClassical applies the earthly COPY command, with classical args.
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 ¶
FinalizeStates returns the LLB states.
func (*Converter) From ¶
func (c *Converter) From(ctx context.Context, imageName string, platform *specs.Platform, buildArgs []string) error
From applies the earthly FROM command.
func (*Converter) FromDockerfile ¶ added in v0.3.0
func (c *Converter) FromDockerfile(ctx context.Context, contextPath string, dfPath string, dfTarget string, platform *specs.Platform, buildArgs []string) error
FromDockerfile applies the earthly FROM DOCKERFILE command.
func (*Converter) GitClone ¶
func (c *Converter) GitClone(ctx context.Context, gitURL string, branch string, dest string, keepTs bool) error
GitClone applies the GIT CLONE 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, mounts, secretKeyValues []string, privileged, withEntrypoint, withDocker, isWithShell, pushFlag, withSSH, noCache bool) error
Run applies the earthly RUN command.
func (*Converter) RunLocal ¶ added in v0.4.6
RunLocal applies a RUN statement locally rather than in a container
func (*Converter) SaveArtifact ¶
func (c *Converter) SaveArtifact(ctx context.Context, saveFrom string, saveTo string, saveAsLocalTo string, keepTs bool, keepOwn bool, ifExists bool, isPush bool) error
SaveArtifact applies the earthly SAVE ARTIFACT command.
func (*Converter) SaveImage ¶
func (c *Converter) SaveImage(ctx context.Context, imageNames []string, pushImages bool, insecurePush bool, cacheHint bool, cacheFrom []string) error
SaveImage applies the earthly SAVE IMAGE command.
func (*Converter) WithDockerRun ¶ added in v0.3.2
WithDockerRun applies an entire WITH DOCKER ... RUN ... END clause.
type DockerLoadOpt ¶ added in v0.3.2
type DockerLoadOpt struct { Target string ImageName string Platform *specs.Platform BuildArgs []string }
DockerLoadOpt holds parameters for WITH DOCKER --load parameter.
type DockerPullOpt ¶ added in v0.4.2
DockerPullOpt holds parameters for the WITH DOCKER --pull parameter.
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 NoCache bool Pulls []DockerPullOpt Loads []DockerLoadOpt ComposeFiles []string ComposeServices []string }
WithDockerOpt holds parameters for WITH DOCKER run.