mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 13:37:08 +08:00
vendor: github.com/moby/buildkit v0.21.0-rc2
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
59
vendor/github.com/moby/buildkit/client/build.go
generated
vendored
59
vendor/github.com/moby/buildkit/client/build.go
generated
vendored
@ -53,7 +53,8 @@ func (c *Client) Build(ctx context.Context, opt SolveOpt, product string, buildF
|
||||
return err
|
||||
}
|
||||
|
||||
gwClient.caps = g.BuildOpts().Caps
|
||||
caps := g.BuildOpts().Caps
|
||||
gwClient.caps = &caps
|
||||
|
||||
if err := g.Run(ctx, buildFunc); err != nil {
|
||||
return errors.Wrap(err, "failed to run Build function")
|
||||
@ -72,10 +73,14 @@ func (c *Client) gatewayClientForBuild(buildid string) *gatewayClientForBuild {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) GatewayClientForBuild(buildid string) gatewayapi.LLBBridgeClient {
|
||||
return c.gatewayClientForBuild(buildid)
|
||||
}
|
||||
|
||||
type gatewayClientForBuild struct {
|
||||
gateway gatewayapi.LLBBridgeClient
|
||||
buildID string
|
||||
caps apicaps.CapSet
|
||||
caps *apicaps.CapSet
|
||||
}
|
||||
|
||||
func (g *gatewayClientForBuild) ResolveImageConfig(ctx context.Context, in *gatewayapi.ResolveImageConfigRequest, opts ...grpc.CallOption) (*gatewayapi.ResolveImageConfigResponse, error) {
|
||||
@ -99,29 +104,35 @@ func (g *gatewayClientForBuild) ReadFile(ctx context.Context, in *gatewayapi.Rea
|
||||
}
|
||||
|
||||
func (g *gatewayClientForBuild) ReadDir(ctx context.Context, in *gatewayapi.ReadDirRequest, opts ...grpc.CallOption) (*gatewayapi.ReadDirResponse, error) {
|
||||
if err := g.caps.Supports(gatewayapi.CapReadDir); err != nil {
|
||||
return nil, err
|
||||
if g.caps != nil {
|
||||
if err := g.caps.Supports(gatewayapi.CapReadDir); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
ctx = buildid.AppendToOutgoingContext(ctx, g.buildID)
|
||||
return g.gateway.ReadDir(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (g *gatewayClientForBuild) StatFile(ctx context.Context, in *gatewayapi.StatFileRequest, opts ...grpc.CallOption) (*gatewayapi.StatFileResponse, error) {
|
||||
if err := g.caps.Supports(gatewayapi.CapStatFile); err != nil {
|
||||
return nil, err
|
||||
if g.caps != nil {
|
||||
if err := g.caps.Supports(gatewayapi.CapStatFile); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
ctx = buildid.AppendToOutgoingContext(ctx, g.buildID)
|
||||
return g.gateway.StatFile(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (g *gatewayClientForBuild) Evaluate(ctx context.Context, in *gatewayapi.EvaluateRequest, opts ...grpc.CallOption) (*gatewayapi.EvaluateResponse, error) {
|
||||
if err := g.caps.Supports(gatewayapi.CapGatewayEvaluate); err != nil {
|
||||
if err2 := g.caps.Supports(gatewayapi.CapStatFile); err2 != nil {
|
||||
return nil, err
|
||||
if g.caps != nil {
|
||||
if err := g.caps.Supports(gatewayapi.CapGatewayEvaluate); err != nil {
|
||||
if err2 := g.caps.Supports(gatewayapi.CapStatFile); err2 != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctx = buildid.AppendToOutgoingContext(ctx, g.buildID)
|
||||
_, err := g.gateway.StatFile(ctx, &gatewayapi.StatFileRequest{Ref: in.Ref, Path: "."}, opts...)
|
||||
return &gatewayapi.EvaluateResponse{}, err
|
||||
}
|
||||
ctx = buildid.AppendToOutgoingContext(ctx, g.buildID)
|
||||
_, err := g.gateway.StatFile(ctx, &gatewayapi.StatFileRequest{Ref: in.Ref, Path: "."}, opts...)
|
||||
return &gatewayapi.EvaluateResponse{}, err
|
||||
}
|
||||
ctx = buildid.AppendToOutgoingContext(ctx, g.buildID)
|
||||
return g.gateway.Evaluate(ctx, in, opts...)
|
||||
@ -138,32 +149,40 @@ func (g *gatewayClientForBuild) Return(ctx context.Context, in *gatewayapi.Retur
|
||||
}
|
||||
|
||||
func (g *gatewayClientForBuild) Inputs(ctx context.Context, in *gatewayapi.InputsRequest, opts ...grpc.CallOption) (*gatewayapi.InputsResponse, error) {
|
||||
if err := g.caps.Supports(gatewayapi.CapFrontendInputs); err != nil {
|
||||
return nil, err
|
||||
if g.caps != nil {
|
||||
if err := g.caps.Supports(gatewayapi.CapFrontendInputs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
ctx = buildid.AppendToOutgoingContext(ctx, g.buildID)
|
||||
return g.gateway.Inputs(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (g *gatewayClientForBuild) NewContainer(ctx context.Context, in *gatewayapi.NewContainerRequest, opts ...grpc.CallOption) (*gatewayapi.NewContainerResponse, error) {
|
||||
if err := g.caps.Supports(gatewayapi.CapGatewayExec); err != nil {
|
||||
return nil, err
|
||||
if g.caps != nil {
|
||||
if err := g.caps.Supports(gatewayapi.CapGatewayExec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
ctx = buildid.AppendToOutgoingContext(ctx, g.buildID)
|
||||
return g.gateway.NewContainer(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (g *gatewayClientForBuild) ReleaseContainer(ctx context.Context, in *gatewayapi.ReleaseContainerRequest, opts ...grpc.CallOption) (*gatewayapi.ReleaseContainerResponse, error) {
|
||||
if err := g.caps.Supports(gatewayapi.CapGatewayExec); err != nil {
|
||||
return nil, err
|
||||
if g.caps != nil {
|
||||
if err := g.caps.Supports(gatewayapi.CapGatewayExec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
ctx = buildid.AppendToOutgoingContext(ctx, g.buildID)
|
||||
return g.gateway.ReleaseContainer(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (g *gatewayClientForBuild) ExecProcess(ctx context.Context, opts ...grpc.CallOption) (gatewayapi.LLBBridge_ExecProcessClient, error) {
|
||||
if err := g.caps.Supports(gatewayapi.CapGatewayExec); err != nil {
|
||||
return nil, err
|
||||
if g.caps != nil {
|
||||
if err := g.caps.Supports(gatewayapi.CapGatewayExec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
ctx = buildid.AppendToOutgoingContext(ctx, g.buildID)
|
||||
return g.gateway.ExecProcess(ctx, opts...)
|
||||
|
33
vendor/github.com/moby/buildkit/client/llb/source.go
generated
vendored
33
vendor/github.com/moby/buildkit/client/llb/source.go
generated
vendored
@ -435,6 +435,13 @@ func Local(name string, opts ...LocalOption) State {
|
||||
addCap(&gi.Constraints, pb.CapSourceLocalDiffer)
|
||||
}
|
||||
}
|
||||
if gi.MetadataOnlyCollector {
|
||||
attrs[pb.AttrMetadataTransfer] = "true"
|
||||
if gi.MetadataOnlyExceptions != "" {
|
||||
attrs[pb.AttrMetadataTransferExclude] = gi.MetadataOnlyExceptions
|
||||
}
|
||||
addCap(&gi.Constraints, pb.CapSourceMetadataTransfer)
|
||||
}
|
||||
|
||||
addCap(&gi.Constraints, pb.CapSourceLocal)
|
||||
|
||||
@ -506,6 +513,18 @@ func Differ(t DiffType, required bool) LocalOption {
|
||||
})
|
||||
}
|
||||
|
||||
func MetadataOnlyTransfer(exceptions []string) LocalOption {
|
||||
return localOptionFunc(func(li *LocalInfo) {
|
||||
li.MetadataOnlyCollector = true
|
||||
if len(exceptions) == 0 {
|
||||
li.MetadataOnlyExceptions = ""
|
||||
} else {
|
||||
dt, _ := json.Marshal(exceptions) // empty on error
|
||||
li.MetadataOnlyExceptions = string(dt)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func OCILayout(ref string, opts ...OCILayoutOption) State {
|
||||
gi := &OCILayoutInfo{}
|
||||
|
||||
@ -578,12 +597,14 @@ type DifferInfo struct {
|
||||
|
||||
type LocalInfo struct {
|
||||
constraintsWrapper
|
||||
SessionID string
|
||||
IncludePatterns string
|
||||
ExcludePatterns string
|
||||
FollowPaths string
|
||||
SharedKeyHint string
|
||||
Differ DifferInfo
|
||||
SessionID string
|
||||
IncludePatterns string
|
||||
ExcludePatterns string
|
||||
FollowPaths string
|
||||
SharedKeyHint string
|
||||
Differ DifferInfo
|
||||
MetadataOnlyCollector bool
|
||||
MetadataOnlyExceptions string
|
||||
}
|
||||
|
||||
func HTTP(url string, opts ...HTTPOption) State {
|
||||
|
2
vendor/github.com/moby/buildkit/client/solve.go
generated
vendored
2
vendor/github.com/moby/buildkit/client/solve.go
generated
vendored
@ -35,6 +35,7 @@ import (
|
||||
|
||||
type SolveOpt struct {
|
||||
Exports []ExportEntry
|
||||
EnableSessionExporter bool
|
||||
LocalDirs map[string]string // Deprecated: use LocalMounts
|
||||
LocalMounts map[string]fsutil.FS
|
||||
OCIStores map[string]content.Store
|
||||
@ -270,6 +271,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||
Exporters: exports,
|
||||
ExporterDeprecated: exportDeprecated,
|
||||
ExporterAttrsDeprecated: exportAttrDeprecated,
|
||||
EnableSessionExporter: opt.EnableSessionExporter,
|
||||
Session: s.ID(),
|
||||
Frontend: opt.Frontend,
|
||||
FrontendAttrs: frontendAttrs,
|
||||
|
Reference in New Issue
Block a user