Documentation ¶
Index ¶
- Constants
- func BuildWithPlatform(ctx context.Context, client gwclient.Client, f PlatformBuildFunc) (*gwclient.Result, error)
- func ForwarderFromClient(ctx context.Context, client gwclient.Client) dalec.ForwarderFunc
- func GetBuildArg(client gwclient.Client, k string) (string, bool)
- func GetTargetKey(client BuildOpstGetter) string
- func LoadSpec(ctx context.Context, client *dockerui.Client, platform *ocispecs.Platform) (*dalec.Spec, error)
- func MaybeSign(ctx context.Context, client gwclient.Client, st llb.State, spec *dalec.Spec, ...) (llb.State, error)
- func RunTests(ctx context.Context, client gwclient.Client, spec *dalec.Spec, ...) error
- func SourceOptFromClient(ctx context.Context, c gwclient.Client) (dalec.SourceOpts, error)
- func SupportsDiffMerge(client gwclient.Client) bool
- func Warn(ctx context.Context, client gwclient.Client, st llb.State, msg string)
- func Warnf(ctx context.Context, client gwclient.Client, st llb.State, format string, ...)
- func WithBuiltinHandler(key string, bf gwclient.BuildFunc) func(context.Context, gwclient.Client, *BuildMux) error
- func WithTargetForwardingHandler(ctx context.Context, client gwclient.Client, m *BuildMux) error
- type BuildMux
- func (m *BuildMux) Add(targetPath string, bf gwclient.BuildFunc, info *bktargets.Target)
- func (m *BuildMux) Handle(ctx context.Context, client gwclient.Client) (_ *gwclient.Result, retErr error)
- func (m *BuildMux) Handler(opts ...func(context.Context, gwclient.Client, *BuildMux) error) gwclient.BuildFunc
- type BuildOpstGetter
- type CurrentFrontend
- type PlatformBuildFunc
Constants ¶
const ( // KeyDefaultPlatform is the subreuqest id for returning the default platform // for the builder. KeyDefaultPlatform = "frontend.dalec.defaultPlatform" )
Variables ¶
This section is empty.
Functions ¶
func BuildWithPlatform ¶ added in v0.3.0
func BuildWithPlatform(ctx context.Context, client gwclient.Client, f PlatformBuildFunc) (*gwclient.Result, error)
BuildWithPlatform is a helper function to build a spec with a given platform It takes care of looping through each tarrget platform and executing the build with the platform args substituted in the spec. This also deals with the docker-style multi-platform output.
func ForwarderFromClient ¶
ForwarderFromClient creates a dalec.ForwarderFunc from a gateway client. This is used for forwarding builds to other frontends in dalec.Source2LLBGetter
func GetTargetKey ¶ added in v0.3.0
func GetTargetKey(client BuildOpstGetter) string
GetTargetKey returns the key that should be used to select the dalec.Target from the dalec.Spec
func RunTests ¶
func RunTests(ctx context.Context, client gwclient.Client, spec *dalec.Spec, ref gwclient.Reference, withTestDeps llb.StateOption, target string) error
Run tests runs the tests defined in the spec against the given target container.
func SourceOptFromClient ¶
func SupportsDiffMerge ¶
SupportsDiffMerge checks if the given client supports the diff and merge operations.
func WithBuiltinHandler ¶ added in v0.3.0
func WithBuiltinHandler(key string, bf gwclient.BuildFunc) func(context.Context, gwclient.Client, *BuildMux) error
WithBuiltinHandler registers a late-binding handler for the given target key. These are only added if the target is in the spec OR the spec has no explicit targets.
Types ¶
type BuildMux ¶ added in v0.3.0
type BuildMux struct {
// contains filtered or unexported fields
}
BuildMux route handlers also must be buildkit BuildFuncs. As such a handler can itself also be a distinc BuildMux with its own set of routes. This allows handlers to also do their own routing. All logic for what to route is handled outside of the BuildMux.
BuildMux and buildkit BuildFunc have a similar relationship as http.ServeMux and http.Handler (where http.ServeMux is an http.Handler). In the same way BuildMux is a BuildFunc (or rather BuildMux.Handle is). So BuildMux can be nested.
When BuildMux calls a handler, it modifies the client to chomp off the matched route prefix. So a BuildMux with receiving a build target of mariner2/container will match on the registered handler for mariner2 then call the handler with the build target changed to just container.
Finally, BuildMux sets an extra build option on the client dalec.target=<matched prefix>. This is only done if the dalec.target option is not already set, so dalec.target is only modified once and then used in handlers to determine which target in spec.Targets applies to them.
func (*BuildMux) Add ¶ added in v0.3.0
Add adds a handler for the given target [targetKey] is the resource path to be handled
type BuildOpstGetter ¶ added in v0.3.0
type CurrentFrontend ¶ added in v0.3.0
CurrentFrontend is an interface typically implemented by a gwclient.Client This is used to get the rootfs of the current frontend.