Documentation
¶
Index ¶
- Constants
- func BuildWithPlatform(ctx context.Context, client gwclient.Client, f PlatformBuildFunc) (*gwclient.Result, error)
- func BuildWithPlatformFromUIClient(ctx context.Context, client gwclient.Client, dc *dockerui.Client, ...) (*gwclient.Result, error)
- func ForwarderFromClient(ctx context.Context, client gwclient.Client) dalec.ForwarderFunc
- func GetBaseImage(sOpt dalec.SourceOpts, ref string, opts ...llb.ConstraintsOpt) llb.State
- func GetBuildArg(client gwclient.Client, k string) (string, bool)
- func GetCurrentFrontend(client gwclient.Client) llb.State
- func GetTargetKey(client BuildOpstGetter) string
- func IgnoreCache(client gwclient.Client, refs ...string) llb.ConstraintsOpt
- func LoadSpec(ctx context.Context, client *dockerui.Client, platform *ocispecs.Platform, ...) (*dalec.Spec, error)
- func LoadSpecForRouting(ctx context.Context, client gwclient.Client) (*dalec.Spec, error)
- func MaybeSign(ctx context.Context, client gwclient.Client, st llb.State, spec *dalec.Spec, ...) llb.State
- func RunTests(ctx context.Context, client gwclient.Client, sOpt dalec.SourceOpts, ...) llb.StateOption
- func SourceOptFromClient(ctx context.Context, c gwclient.Client, platform *ocispecs.Platform) (dalec.SourceOpts, error)
- func SourceOptFromUIClient(ctx context.Context, c gwclient.Client, dc *dockerui.Client, ...) dalec.SourceOpts
- func SupportsDiffMerge(client gwclient.Client) bool
- func TestWithClientFrontend(client gwclient.Client) testrunner.ValidationOpt
- 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 WithDefaultPlatform(platform ocispecs.Platform, build gwclient.BuildFunc) gwclient.BuildFunc
- func WithTargetForwardingHandler(ctx context.Context, client gwclient.Client, r *Router) error
- type BuildOpstGetter
- type Forward
- type LoadConfig
- type LoadOpt
- type PlatformBuildFunc
- type Route
- type Router
- type Target
- type TargetList
Constants ¶
const ( // KeyDefaultPlatform is the subrequest id for returning the default platform // for the builder. KeyDefaultPlatform = "frontend.dalec.defaultPlatform" KeyJSONSchema = "frontend.dalec.schema" )
const IgnoreCacheTestsKey = "dalec.tests"
Variables ¶
This section is empty.
Functions ¶
func BuildWithPlatform ¶
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 target platform and executing the build with the platform args substituted in the spec. This also deals with the docker-style multi-platform output.
func BuildWithPlatformFromUIClient ¶
func BuildWithPlatformFromUIClient(ctx context.Context, client gwclient.Client, dc *dockerui.Client, f PlatformBuildFunc) (*gwclient.Result, error)
Like BuildWithPlatform but with a pre-initialized dockerui.Client
func ForwarderFromClient ¶
ForwarderFromClient creates a dalec.ForwarderFunc from a gateway client. This is used for forwarding builds to other frontends in dalec.Source2LLBGetter
func GetBaseImage ¶
func GetBaseImage(sOpt dalec.SourceOpts, ref string, opts ...llb.ConstraintsOpt) llb.State
GetBaseImage returns an image that first checks if the client provided the image in the build context matching the image ref.
This follows the behavior of of the dockerfile frontend.
func GetTargetKey ¶
func GetTargetKey(client BuildOpstGetter) string
GetTargetKey returns the key that should be used to select the dalec.Target from the dalec.Spec
func IgnoreCache ¶
func IgnoreCache(client gwclient.Client, refs ...string) llb.ConstraintsOpt
Returns a ConstraintsOpt that ignores the cache if the client is configured to ignore the cache for any of the given refs OR if the global no-cache option is set.
func LoadSpecForRouting ¶ added in v0.21.0
LoadSpecForRouting loads a dalec spec from the gateway client's build context for routing purposes only. Build args are substituted with WithAllowAnyArg so that unresolved args don't cause errors during route setup.
func RunTests ¶
func RunTests(ctx context.Context, client gwclient.Client, sOpt dalec.SourceOpts, spec *dalec.Spec, withTestDeps llb.StateOption, target string, opts ...llb.ConstraintsOpt) llb.StateOption
RunTests runs the tests defined in the spec against the given target container.
func SourceOptFromClient ¶
func SourceOptFromUIClient ¶
func SupportsDiffMerge ¶
SupportsDiffMerge checks if the given client supports the diff and merge operations.
func TestWithClientFrontend ¶ added in v0.21.0
func TestWithClientFrontend(client gwclient.Client) testrunner.ValidationOpt
func WithDefaultPlatform ¶
WithDefaultPlatform is a helper function to set a default platform for a build if the client does not provide one.
Types ¶
type BuildOpstGetter ¶
type Forward ¶ added in v0.21.0
Forward holds the configuration needed to query a forwarded frontend's target list at list time.
type LoadConfig ¶
type LoadConfig struct {
SubstituteOpts []dalec.SubstituteOpt
}
type PlatformBuildFunc ¶
type Route ¶ added in v0.21.0
type Route struct {
// FullPath is the fully qualified route path, e.g. "azlinux3/container".
FullPath string
// Handler is the build function that handles this route.
Handler gwclient.BuildFunc
// Info contains target metadata for the target list API.
Info Target
// Forward, if set, indicates this route forwards to an external frontend.
// The target list queries the remote frontend lazily to discover sub-targets.
Forward *Forward
}
Route is a single entry in the flat router.
type Router ¶ added in v0.21.0
type Router struct {
// contains filtered or unexported fields
}
Router is a flat route table where all routes are fully qualified paths. It replaces the hierarchical BuildMux with a simpler dispatch model.
func (*Router) Add ¶ added in v0.21.0
Add registers a route. If a route with the same FullPath already exists it is overwritten (this is used by target forwarding to override builtins).
func (*Router) Handle ¶ added in v0.21.0
func (r *Router) Handle(ctx context.Context, client gwclient.Client) (_ *gwclient.Result, retErr error)
Handle is the main dispatch function. It handles subrequests, then looks up the target in the route table and calls the matched handler.
func (*Router) Handler ¶ added in v0.21.0
func (r *Router) Handler(opts ...func(context.Context, gwclient.Client, *Router) error) gwclient.BuildFunc
Handler returns a gwclient.BuildFunc that dispatches requests through the router. Option functions run once at the start of each request before dispatch.
type Target ¶ added in v0.21.0
type Target struct {
bktargets.Target
// SpecDefined indicates that the top-level target key for this route
// appears in spec.Targets. When spec.Targets is empty (no explicit
// target filtering), this field is false for all targets.
SpecDefined bool `json:"specDefined,omitempty"`
// Hidden indicates that this route should not appear in the target
// list but is still dispatchable. This is used for routes like bare
// distro names (e.g. "mariner2") that act as aliases for a default
// sub-route (e.g. "mariner2/container").
Hidden bool `json:"hidden,omitempty"`
}
Target wraps bktargets.Target with dalec-specific metadata for richer target list responses.
type TargetList ¶ added in v0.21.0
type TargetList struct {
Targets []Target `json:"targets"`
}
TargetList is the dalec-extended target list response.