mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to master@ae9d0f5
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
69
vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go
generated
vendored
69
vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go
generated
vendored
@ -115,7 +115,7 @@ func (c *grpcClient) Run(ctx context.Context, f client.BuildFunc) (retError erro
|
||||
req := &pb.ReturnRequest{}
|
||||
if retError == nil {
|
||||
if res == nil {
|
||||
res = &client.Result{}
|
||||
res = client.NewResult()
|
||||
}
|
||||
pbRes := &pb.Result{
|
||||
Metadata: res.Metadata,
|
||||
@ -160,6 +160,25 @@ func (c *grpcClient) Run(ctx context.Context, f client.BuildFunc) (retError erro
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if res.Attestations != nil && c.caps.Supports(pb.CapAttestations) == nil {
|
||||
attestations := map[string]*pb.Attestations{}
|
||||
for k, as := range res.Attestations {
|
||||
for _, a := range as {
|
||||
pbAtt, err := client.AttestationToPB(&a)
|
||||
if err != nil {
|
||||
retError = err
|
||||
continue
|
||||
}
|
||||
if attestations[k] == nil {
|
||||
attestations[k] = &pb.Attestations{}
|
||||
}
|
||||
attestations[k].Attestation = append(attestations[k].Attestation, pbAtt)
|
||||
}
|
||||
}
|
||||
pbRes.Attestations = attestations
|
||||
}
|
||||
|
||||
if retError == nil {
|
||||
req.Result = pbRes
|
||||
}
|
||||
@ -368,30 +387,15 @@ func (c *grpcClient) Solve(ctx context.Context, creq client.SolveRequest) (res *
|
||||
if c.caps.Supports(pb.CapGatewayEvaluateSolve) == nil {
|
||||
req.Evaluate = creq.Evaluate
|
||||
} else {
|
||||
// If evaluate is not supported, fallback to running Stat(".") in order to
|
||||
// trigger an evaluation of the result.
|
||||
// If evaluate is not supported, fallback to running Stat(".") in
|
||||
// order to trigger an evaluation of the result.
|
||||
defer func() {
|
||||
if res == nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
id string
|
||||
ref client.Reference
|
||||
)
|
||||
ref, err = res.SingleRef()
|
||||
if err != nil {
|
||||
for refID := range res.Refs {
|
||||
id = refID
|
||||
break
|
||||
}
|
||||
} else {
|
||||
id = ref.(*reference).id
|
||||
}
|
||||
|
||||
_, err = c.client.StatFile(ctx, &pb.StatFileRequest{
|
||||
Ref: id,
|
||||
Path: ".",
|
||||
err = res.EachRef(func(ref client.Reference) error {
|
||||
_, err := ref.StatFile(ctx, client.StatRequest{Path: "."})
|
||||
return err
|
||||
})
|
||||
}()
|
||||
}
|
||||
@ -402,7 +406,7 @@ func (c *grpcClient) Solve(ctx context.Context, creq client.SolveRequest) (res *
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = &client.Result{}
|
||||
res = client.NewResult()
|
||||
if resp.Result == nil {
|
||||
if id := resp.Ref; id != "" {
|
||||
c.requests[id] = req
|
||||
@ -443,6 +447,18 @@ func (c *grpcClient) Solve(ctx context.Context, creq client.SolveRequest) (res *
|
||||
res.AddRef(k, ref)
|
||||
}
|
||||
}
|
||||
|
||||
if resp.Result.Attestations != nil {
|
||||
for p, as := range resp.Result.Attestations {
|
||||
for _, a := range as.Attestation {
|
||||
att, err := client.AttestationFromPB(a)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res.AddAttestation(p, *att, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res, nil
|
||||
@ -1023,6 +1039,15 @@ func (r *reference) ToState() (st llb.State, err error) {
|
||||
return llb.NewState(defop), nil
|
||||
}
|
||||
|
||||
func (r *reference) Evaluate(ctx context.Context) error {
|
||||
req := &pb.EvaluateRequest{Ref: r.id}
|
||||
_, err := r.c.client.Evaluate(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *reference) ReadFile(ctx context.Context, req client.ReadRequest) ([]byte, error) {
|
||||
rfr := &pb.ReadFileRequest{FilePath: req.Filename, Ref: r.id}
|
||||
if r := req.Range; r != nil {
|
||||
|
Reference in New Issue
Block a user