mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 05:27:07 +08:00
vendor: update buildkit
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
3
vendor/github.com/moby/buildkit/session/auth/authprovider/authprovider.go
generated
vendored
3
vendor/github.com/moby/buildkit/session/auth/authprovider/authprovider.go
generated
vendored
@ -5,7 +5,6 @@ import (
|
||||
"crypto/ed25519"
|
||||
"crypto/hmac"
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@ -191,8 +190,6 @@ func (ap *authProvider) getAuthorityKey(host string, salt []byte) (ed25519.Priva
|
||||
mac := hmac.New(sha256.New, salt)
|
||||
if creds.Secret != "" {
|
||||
mac.Write(seed)
|
||||
enc := json.NewEncoder(mac)
|
||||
enc.Encode(creds)
|
||||
}
|
||||
|
||||
sum := mac.Sum(nil)
|
||||
|
6
vendor/github.com/moby/buildkit/session/auth/authprovider/tokenseed.go
generated
vendored
6
vendor/github.com/moby/buildkit/session/auth/authprovider/tokenseed.go
generated
vendored
@ -37,7 +37,7 @@ func (ts *tokenSeeds) getSeed(host string) ([]byte, error) {
|
||||
|
||||
l := flock.New(filepath.Join(ts.dir, ".token_seed.lock"))
|
||||
if err := l.Lock(); err != nil {
|
||||
if !errors.Is(err, syscall.EROFS) && errors.Is(err, syscall.EPERM) {
|
||||
if !errors.Is(err, syscall.EROFS) && !errors.Is(err, os.ErrPermission) {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
@ -49,7 +49,7 @@ func (ts *tokenSeeds) getSeed(host string) ([]byte, error) {
|
||||
// we include client side randomness to avoid chosen plaintext attack from the daemon side
|
||||
dt, err := ioutil.ReadFile(fp)
|
||||
if err != nil {
|
||||
if !errors.Is(err, os.ErrNotExist) && !errors.Is(err, syscall.ENOTDIR) {
|
||||
if !errors.Is(err, os.ErrNotExist) && !errors.Is(err, syscall.ENOTDIR) && !errors.Is(err, os.ErrPermission) {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
@ -69,7 +69,7 @@ func (ts *tokenSeeds) getSeed(host string) ([]byte, error) {
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(fp, dt, 0600); err != nil {
|
||||
if !errors.Is(err, syscall.EROFS) && !errors.Is(err, syscall.EPERM) {
|
||||
if !errors.Is(err, syscall.EROFS) && !errors.Is(err, os.ErrPermission) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
4
vendor/github.com/moby/buildkit/session/content/attachable.go
generated
vendored
4
vendor/github.com/moby/buildkit/session/content/attachable.go
generated
vendored
@ -9,7 +9,7 @@ import (
|
||||
"github.com/containerd/containerd/services/content/contentserver"
|
||||
"github.com/moby/buildkit/session"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/metadata"
|
||||
@ -104,7 +104,7 @@ func (cs *attachableContentStore) Writer(ctx context.Context, opts ...content.Wr
|
||||
return store.Writer(ctx, opts...)
|
||||
}
|
||||
|
||||
func (cs *attachableContentStore) ReaderAt(ctx context.Context, desc ocispec.Descriptor) (content.ReaderAt, error) {
|
||||
func (cs *attachableContentStore) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (content.ReaderAt, error) {
|
||||
store, err := cs.choose(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
4
vendor/github.com/moby/buildkit/session/content/caller.go
generated
vendored
4
vendor/github.com/moby/buildkit/session/content/caller.go
generated
vendored
@ -8,7 +8,7 @@ import (
|
||||
"github.com/containerd/containerd/content/proxy"
|
||||
"github.com/moby/buildkit/session"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
@ -75,7 +75,7 @@ func (cs *callerContentStore) Writer(ctx context.Context, opts ...content.Writer
|
||||
return w, errors.WithStack(err)
|
||||
}
|
||||
|
||||
func (cs *callerContentStore) ReaderAt(ctx context.Context, desc ocispec.Descriptor) (content.ReaderAt, error) {
|
||||
func (cs *callerContentStore) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (content.ReaderAt, error) {
|
||||
ctx = cs.choose(ctx)
|
||||
ra, err := cs.store.ReaderAt(ctx, desc)
|
||||
return ra, errors.WithStack(err)
|
||||
|
5
vendor/github.com/moby/buildkit/session/filesync/diffcopy.go
generated
vendored
5
vendor/github.com/moby/buildkit/session/filesync/diffcopy.go
generated
vendored
@ -7,8 +7,9 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/tonistiigi/fsutil"
|
||||
fstypes "github.com/tonistiigi/fsutil/types"
|
||||
"google.golang.org/grpc"
|
||||
@ -73,7 +74,7 @@ func (wc *streamWriterCloser) Close() error {
|
||||
func recvDiffCopy(ds grpc.ClientStream, dest string, cu CacheUpdater, progress progressCb, differ fsutil.DiffType, filter func(string, *fstypes.Stat) bool) (err error) {
|
||||
st := time.Now()
|
||||
defer func() {
|
||||
logrus.Debugf("diffcopy took: %v", time.Since(st))
|
||||
bklog.G(ds.Context()).Debugf("diffcopy took: %v", time.Since(st))
|
||||
}()
|
||||
var cf fsutil.ChangeFunc
|
||||
var ch fsutil.ContentHasher
|
||||
|
12
vendor/github.com/moby/buildkit/session/filesync/filesync.go
generated
vendored
12
vendor/github.com/moby/buildkit/session/filesync/filesync.go
generated
vendored
@ -64,7 +64,7 @@ func (sp *fsSyncProvider) TarStream(stream FileSync_TarStreamServer) error {
|
||||
func (sp *fsSyncProvider) handle(method string, stream grpc.ServerStream) (retErr error) {
|
||||
var pr *protocol
|
||||
for _, p := range supportedProtocols {
|
||||
if method == p.name && isProtoSupported(p.name) {
|
||||
if method == p.name {
|
||||
pr = &p
|
||||
break
|
||||
}
|
||||
@ -133,14 +133,6 @@ type protocol struct {
|
||||
recvFn func(stream grpc.ClientStream, destDir string, cu CacheUpdater, progress progressCb, differ fsutil.DiffType, mapFunc func(string, *fstypes.Stat) bool) error
|
||||
}
|
||||
|
||||
func isProtoSupported(p string) bool {
|
||||
// TODO: this should be removed after testing if stability is confirmed
|
||||
if override := os.Getenv("BUILD_STREAM_PROTOCOL"); override != "" {
|
||||
return strings.EqualFold(p, override)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
var supportedProtocols = []protocol{
|
||||
{
|
||||
name: "diffcopy",
|
||||
@ -174,7 +166,7 @@ type CacheUpdater interface {
|
||||
func FSSync(ctx context.Context, c session.Caller, opt FSSendRequestOpt) error {
|
||||
var pr *protocol
|
||||
for _, p := range supportedProtocols {
|
||||
if isProtoSupported(p.name) && c.Supports(session.MethodURL(_FileSync_serviceDesc.ServiceName, p.name)) {
|
||||
if c.Supports(session.MethodURL(_FileSync_serviceDesc.ServiceName, p.name)) {
|
||||
pr = &p
|
||||
break
|
||||
}
|
||||
|
4
vendor/github.com/moby/buildkit/session/grpc.go
generated
vendored
4
vendor/github.com/moby/buildkit/session/grpc.go
generated
vendored
@ -7,9 +7,9 @@ import (
|
||||
"time"
|
||||
|
||||
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
"github.com/moby/buildkit/util/grpcerrors"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"golang.org/x/net/http2"
|
||||
@ -22,7 +22,7 @@ func serve(ctx context.Context, grpcServer *grpc.Server, conn net.Conn) {
|
||||
<-ctx.Done()
|
||||
conn.Close()
|
||||
}()
|
||||
logrus.Debugf("serving grpc connection")
|
||||
bklog.G(ctx).Debugf("serving grpc connection")
|
||||
(&http2.Server{}).ServeConn(conn, &http2.ServeConnOpts{Handler: grpcServer})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user