Merge pull request #40440 from tonistiigi/1903-update-buildkit
[19.03] vendor: update buildkit to ce88aa518
This commit is contained in:
commit
11665130f9
13 changed files with 126 additions and 51 deletions
|
@ -26,8 +26,8 @@ github.com/imdario/mergo 7c29201646fa3de8506f70121347
|
|||
golang.org/x/sync e225da77a7e68af35c70ccbf71af2b83e6acac3c
|
||||
|
||||
# buildkit
|
||||
github.com/moby/buildkit 926935b590c94c3659ebcc49cf44da47c1a65ff6
|
||||
github.com/tonistiigi/fsutil 0f039a052ca1da01626278199624b62aed9b3729
|
||||
github.com/moby/buildkit 57e8ad52170d713233569f6d467e609d2b0f90c9
|
||||
github.com/tonistiigi/fsutil 6c909ab392c173a4264ae1bfcbc0450b9aac0c7d
|
||||
github.com/grpc-ecosystem/grpc-opentracing 8e809c8a86450a29b90dcc9efbf062d0fe6d9746
|
||||
github.com/opentracing/opentracing-go 1361b9cd60be79c4c3a7fa9841b3c132e40066a7
|
||||
github.com/google/shlex 6f45313302b9c56850fc17f99e40caebce98c716
|
||||
|
|
5
vendor/github.com/moby/buildkit/go.mod
generated
vendored
5
vendor/github.com/moby/buildkit/go.mod
generated
vendored
|
@ -1,10 +1,11 @@
|
|||
module github.com/moby/buildkit
|
||||
|
||||
go 1.11
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v0.3.1
|
||||
github.com/Microsoft/go-winio v0.4.13-0.20190408173621-84b4ab48a507
|
||||
github.com/Microsoft/hcsshim v0.8.5 // indirect
|
||||
github.com/apache/thrift v0.0.0-20161221203622-b2a4d4ae21c7 // indirect
|
||||
github.com/codahale/hdrhistogram v0.0.0-20160425231609-f8ad88b59a58 // indirect
|
||||
github.com/containerd/cgroups v0.0.0-20190226200435-dbea6f2bd416 // indirect
|
||||
|
@ -53,7 +54,7 @@ require (
|
|||
github.com/sirupsen/logrus v1.3.0
|
||||
github.com/stretchr/testify v1.3.0
|
||||
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 // indirect
|
||||
github.com/tonistiigi/fsutil v0.0.0-20191018213012-0f039a052ca1
|
||||
github.com/tonistiigi/fsutil v0.0.0-20200128191323-6c909ab392c1
|
||||
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea
|
||||
github.com/uber/jaeger-client-go v0.0.0-20180103221425-e02c85f9069e
|
||||
github.com/uber/jaeger-lib v1.2.1 // indirect
|
||||
|
|
69
vendor/github.com/moby/buildkit/solver/llbsolver/file/backend.go
generated
vendored
69
vendor/github.com/moby/buildkit/solver/llbsolver/file/backend.go
generated
vendored
|
@ -26,33 +26,58 @@ func timestampToTime(ts int64) *time.Time {
|
|||
return &tm
|
||||
}
|
||||
|
||||
func mapUser(user *copy.ChownOpt, idmap *idtools.IdentityMapping) (*copy.ChownOpt, error) {
|
||||
if idmap == nil || user == nil {
|
||||
return user, nil
|
||||
func mapUserToChowner(user *copy.User, idmap *idtools.IdentityMapping) (copy.Chowner, error) {
|
||||
if user == nil {
|
||||
return func(old *copy.User) (*copy.User, error) {
|
||||
if old == nil {
|
||||
if idmap == nil {
|
||||
return nil, nil
|
||||
}
|
||||
old = ©.User{} // root
|
||||
}
|
||||
if idmap != nil {
|
||||
identity, err := idmap.ToHost(idtools.Identity{
|
||||
UID: old.Uid,
|
||||
GID: old.Gid,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ©.User{Uid: identity.UID, Gid: identity.GID}, nil
|
||||
}
|
||||
return old, nil
|
||||
}, nil
|
||||
}
|
||||
identity, err := idmap.ToHost(idtools.Identity{
|
||||
UID: user.Uid,
|
||||
GID: user.Gid,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
u := *user
|
||||
if idmap != nil {
|
||||
identity, err := idmap.ToHost(idtools.Identity{
|
||||
UID: user.Uid,
|
||||
GID: user.Gid,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u.Uid = identity.UID
|
||||
u.Gid = identity.GID
|
||||
}
|
||||
return ©.ChownOpt{Uid: identity.UID, Gid: identity.GID}, nil
|
||||
return func(*copy.User) (*copy.User, error) {
|
||||
return &u, nil
|
||||
}, nil
|
||||
}
|
||||
|
||||
func mkdir(ctx context.Context, d string, action pb.FileActionMkDir, user *copy.ChownOpt, idmap *idtools.IdentityMapping) error {
|
||||
func mkdir(ctx context.Context, d string, action pb.FileActionMkDir, user *copy.User, idmap *idtools.IdentityMapping) error {
|
||||
p, err := fs.RootPath(d, filepath.Join(filepath.Join("/", action.Path)))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
user, err = mapUser(user, idmap)
|
||||
ch, err := mapUserToChowner(user, idmap)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if action.MakeParents {
|
||||
if err := copy.MkdirAll(p, os.FileMode(action.Mode)&0777, user, timestampToTime(action.Timestamp)); err != nil {
|
||||
if err := copy.MkdirAll(p, os.FileMode(action.Mode)&0777, ch, timestampToTime(action.Timestamp)); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
|
@ -62,7 +87,7 @@ func mkdir(ctx context.Context, d string, action pb.FileActionMkDir, user *copy.
|
|||
}
|
||||
return err
|
||||
}
|
||||
if err := copy.Chown(p, user); err != nil {
|
||||
if err := copy.Chown(p, nil, ch); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := copy.Utimes(p, timestampToTime(action.Timestamp)); err != nil {
|
||||
|
@ -73,13 +98,13 @@ func mkdir(ctx context.Context, d string, action pb.FileActionMkDir, user *copy.
|
|||
return nil
|
||||
}
|
||||
|
||||
func mkfile(ctx context.Context, d string, action pb.FileActionMkFile, user *copy.ChownOpt, idmap *idtools.IdentityMapping) error {
|
||||
func mkfile(ctx context.Context, d string, action pb.FileActionMkFile, user *copy.User, idmap *idtools.IdentityMapping) error {
|
||||
p, err := fs.RootPath(d, filepath.Join(filepath.Join("/", action.Path)))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
user, err = mapUser(user, idmap)
|
||||
ch, err := mapUserToChowner(user, idmap)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -88,7 +113,7 @@ func mkfile(ctx context.Context, d string, action pb.FileActionMkFile, user *cop
|
|||
return err
|
||||
}
|
||||
|
||||
if err := copy.Chown(p, user); err != nil {
|
||||
if err := copy.Chown(p, nil, ch); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -115,7 +140,7 @@ func rm(ctx context.Context, d string, action pb.FileActionRm) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func docopy(ctx context.Context, src, dest string, action pb.FileActionCopy, u *copy.ChownOpt, idmap *idtools.IdentityMapping) error {
|
||||
func docopy(ctx context.Context, src, dest string, action pb.FileActionCopy, u *copy.User, idmap *idtools.IdentityMapping) error {
|
||||
srcPath := cleanPath(action.Src)
|
||||
destPath := cleanPath(action.Dest)
|
||||
|
||||
|
@ -134,14 +159,14 @@ func docopy(ctx context.Context, src, dest string, action pb.FileActionCopy, u *
|
|||
return nil
|
||||
}
|
||||
|
||||
u, err := mapUser(u, idmap)
|
||||
ch, err := mapUserToChowner(u, idmap)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
opt := []copy.Opt{
|
||||
func(ci *copy.CopyInfo) {
|
||||
ci.Chown = u
|
||||
ci.Chown = ch
|
||||
ci.Utime = timestampToTime(action.Timestamp)
|
||||
if m := int(action.Mode); m != -1 {
|
||||
ci.Mode = &m
|
||||
|
@ -154,7 +179,7 @@ func docopy(ctx context.Context, src, dest string, action pb.FileActionCopy, u *
|
|||
|
||||
if !action.AllowWildcard {
|
||||
if action.AttemptUnpackDockerCompatibility {
|
||||
if ok, err := unpack(ctx, src, srcPath, dest, destPath, u, timestampToTime(action.Timestamp)); err != nil {
|
||||
if ok, err := unpack(ctx, src, srcPath, dest, destPath, ch, timestampToTime(action.Timestamp)); err != nil {
|
||||
return err
|
||||
} else if ok {
|
||||
return nil
|
||||
|
@ -177,7 +202,7 @@ func docopy(ctx context.Context, src, dest string, action pb.FileActionCopy, u *
|
|||
|
||||
for _, s := range m {
|
||||
if action.AttemptUnpackDockerCompatibility {
|
||||
if ok, err := unpack(ctx, src, s, dest, destPath, u, timestampToTime(action.Timestamp)); err != nil {
|
||||
if ok, err := unpack(ctx, src, s, dest, destPath, ch, timestampToTime(action.Timestamp)); err != nil {
|
||||
return err
|
||||
} else if ok {
|
||||
continue
|
||||
|
|
4
vendor/github.com/moby/buildkit/solver/llbsolver/file/unpack.go
generated
vendored
4
vendor/github.com/moby/buildkit/solver/llbsolver/file/unpack.go
generated
vendored
|
@ -12,7 +12,7 @@ import (
|
|||
copy "github.com/tonistiigi/fsutil/copy"
|
||||
)
|
||||
|
||||
func unpack(ctx context.Context, srcRoot string, src string, destRoot string, dest string, user *copy.ChownOpt, tm *time.Time) (bool, error) {
|
||||
func unpack(ctx context.Context, srcRoot string, src string, destRoot string, dest string, ch copy.Chowner, tm *time.Time) (bool, error) {
|
||||
src, err := fs.RootPath(srcRoot, src)
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
@ -25,7 +25,7 @@ func unpack(ctx context.Context, srcRoot string, src string, destRoot string, de
|
|||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if err := copy.MkdirAll(dest, 0755, user, tm); err != nil {
|
||||
if err := copy.MkdirAll(dest, 0755, ch, tm); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
|
|
4
vendor/github.com/moby/buildkit/solver/llbsolver/file/user_linux.go
generated
vendored
4
vendor/github.com/moby/buildkit/solver/llbsolver/file/user_linux.go
generated
vendored
|
@ -12,11 +12,11 @@ import (
|
|||
copy "github.com/tonistiigi/fsutil/copy"
|
||||
)
|
||||
|
||||
func readUser(chopt *pb.ChownOpt, mu, mg fileoptypes.Mount) (*copy.ChownOpt, error) {
|
||||
func readUser(chopt *pb.ChownOpt, mu, mg fileoptypes.Mount) (*copy.User, error) {
|
||||
if chopt == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var us copy.ChownOpt
|
||||
var us copy.User
|
||||
if chopt.User != nil {
|
||||
switch u := chopt.User.User.(type) {
|
||||
case *pb.UserOpt_ByName:
|
||||
|
|
2
vendor/github.com/moby/buildkit/solver/llbsolver/file/user_nolinux.go
generated
vendored
2
vendor/github.com/moby/buildkit/solver/llbsolver/file/user_nolinux.go
generated
vendored
|
@ -9,6 +9,6 @@ import (
|
|||
copy "github.com/tonistiigi/fsutil/copy"
|
||||
)
|
||||
|
||||
func readUser(chopt *pb.ChownOpt, mu, mg fileoptypes.Mount) (*copy.ChownOpt, error) {
|
||||
func readUser(chopt *pb.ChownOpt, mu, mg fileoptypes.Mount) (*copy.User, error) {
|
||||
return nil, errors.New("only implemented in linux")
|
||||
}
|
||||
|
|
14
vendor/github.com/tonistiigi/fsutil/copy/copy.go
generated
vendored
14
vendor/github.com/tonistiigi/fsutil/copy/copy.go
generated
vendored
|
@ -146,14 +146,16 @@ func (c *copier) prepareTargetDir(srcFollowed, src, destPath string, copyDirCont
|
|||
return destPath, nil
|
||||
}
|
||||
|
||||
type ChownOpt struct {
|
||||
type User struct {
|
||||
Uid, Gid int
|
||||
}
|
||||
|
||||
type Chowner func(*User) (*User, error)
|
||||
|
||||
type XAttrErrorHandler func(dst, src, xattrKey string, err error) error
|
||||
|
||||
type CopyInfo struct {
|
||||
Chown *ChownOpt
|
||||
Chown Chowner
|
||||
Utime *time.Time
|
||||
AllowWildcards bool
|
||||
Mode *int
|
||||
|
@ -172,7 +174,9 @@ func WithCopyInfo(ci CopyInfo) func(*CopyInfo) {
|
|||
|
||||
func WithChown(uid, gid int) Opt {
|
||||
return func(ci *CopyInfo) {
|
||||
ci.Chown = &ChownOpt{Uid: uid, Gid: gid}
|
||||
ci.Chown = func(*User) (*User, error) {
|
||||
return &User{Uid: uid, Gid: gid}, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,14 +198,14 @@ func AllowXAttrErrors(ci *CopyInfo) {
|
|||
}
|
||||
|
||||
type copier struct {
|
||||
chown *ChownOpt
|
||||
chown Chowner
|
||||
utime *time.Time
|
||||
mode *int
|
||||
inodes map[uint64]string
|
||||
xattrErrorHandler XAttrErrorHandler
|
||||
}
|
||||
|
||||
func newCopier(chown *ChownOpt, tm *time.Time, mode *int, xeh XAttrErrorHandler) *copier {
|
||||
func newCopier(chown Chowner, tm *time.Time, mode *int, xeh XAttrErrorHandler) *copier {
|
||||
if xeh == nil {
|
||||
xeh = func(dst, src, key string, err error) error {
|
||||
return err
|
||||
|
|
12
vendor/github.com/tonistiigi/fsutil/copy/copy_linux.go
generated
vendored
12
vendor/github.com/tonistiigi/fsutil/copy/copy_linux.go
generated
vendored
|
@ -6,7 +6,6 @@ import (
|
|||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/containerd/containerd/sys"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
@ -20,11 +19,14 @@ func (c *copier) copyFileInfo(fi os.FileInfo, name string) error {
|
|||
st := fi.Sys().(*syscall.Stat_t)
|
||||
|
||||
chown := c.chown
|
||||
uid, gid := getUidGid(fi)
|
||||
old := &User{Uid: uid, Gid: gid}
|
||||
if chown == nil {
|
||||
uid, gid := getUidGid(fi)
|
||||
chown = &ChownOpt{Uid: uid, Gid: gid}
|
||||
chown = func(u *User) (*User, error) {
|
||||
return u, nil
|
||||
}
|
||||
}
|
||||
if err := Chown(name, chown); err != nil {
|
||||
if err := Chown(name, old, chown); err != nil {
|
||||
return errors.Wrapf(err, "failed to chown %s", name)
|
||||
}
|
||||
|
||||
|
@ -43,7 +45,7 @@ func (c *copier) copyFileInfo(fi os.FileInfo, name string) error {
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
timespec := []unix.Timespec{unix.Timespec(sys.StatAtime(st)), unix.Timespec(sys.StatMtime(st))}
|
||||
timespec := []unix.Timespec{unix.Timespec(StatAtime(st)), unix.Timespec(StatMtime(st))}
|
||||
if err := unix.UtimesNanoAt(unix.AT_FDCWD, name, timespec, unix.AT_SYMLINK_NOFOLLOW); err != nil {
|
||||
return errors.Wrapf(err, "failed to utime %s", name)
|
||||
}
|
||||
|
|
12
vendor/github.com/tonistiigi/fsutil/copy/copy_unix.go
generated
vendored
12
vendor/github.com/tonistiigi/fsutil/copy/copy_unix.go
generated
vendored
|
@ -6,7 +6,6 @@ import (
|
|||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/containerd/containerd/sys"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
@ -19,11 +18,14 @@ func getUidGid(fi os.FileInfo) (uid, gid int) {
|
|||
func (c *copier) copyFileInfo(fi os.FileInfo, name string) error {
|
||||
st := fi.Sys().(*syscall.Stat_t)
|
||||
chown := c.chown
|
||||
uid, gid := getUidGid(fi)
|
||||
old := &User{Uid: uid, Gid: gid}
|
||||
if chown == nil {
|
||||
uid, gid := getUidGid(fi)
|
||||
chown = &ChownOpt{Uid: uid, Gid: gid}
|
||||
chown = func(u *User) (*User, error) {
|
||||
return u, nil
|
||||
}
|
||||
}
|
||||
if err := Chown(name, chown); err != nil {
|
||||
if err := Chown(name, old, chown); err != nil {
|
||||
return errors.Wrapf(err, "failed to chown %s", name)
|
||||
}
|
||||
|
||||
|
@ -42,7 +44,7 @@ func (c *copier) copyFileInfo(fi os.FileInfo, name string) error {
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
timespec := []unix.Timespec{unix.Timespec(sys.StatAtime(st)), unix.Timespec(sys.StatMtime(st))}
|
||||
timespec := []unix.Timespec{unix.Timespec(StatAtime(st)), unix.Timespec(StatMtime(st))}
|
||||
if err := unix.UtimesNanoAt(unix.AT_FDCWD, name, timespec, unix.AT_SYMLINK_NOFOLLOW); err != nil {
|
||||
return errors.Wrapf(err, "failed to utime %s", name)
|
||||
}
|
||||
|
|
15
vendor/github.com/tonistiigi/fsutil/copy/mkdir.go
generated
vendored
15
vendor/github.com/tonistiigi/fsutil/copy/mkdir.go
generated
vendored
|
@ -4,9 +4,18 @@ import (
|
|||
"os"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func Chown(p string, user *ChownOpt) error {
|
||||
func Chown(p string, old *User, fn Chowner) error {
|
||||
if fn == nil {
|
||||
return nil
|
||||
}
|
||||
user, err := fn(old)
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
if user != nil {
|
||||
if err := os.Lchown(p, user.Uid, user.Gid); err != nil {
|
||||
return err
|
||||
|
@ -16,7 +25,7 @@ func Chown(p string, user *ChownOpt) error {
|
|||
}
|
||||
|
||||
// MkdirAll is forked os.MkdirAll
|
||||
func MkdirAll(path string, perm os.FileMode, user *ChownOpt, tm *time.Time) error {
|
||||
func MkdirAll(path string, perm os.FileMode, user Chowner, tm *time.Time) error {
|
||||
// Fast path: if we can tell whether path is a directory or file, stop with success or error.
|
||||
dir, err := os.Stat(path)
|
||||
if err == nil {
|
||||
|
@ -62,7 +71,7 @@ func MkdirAll(path string, perm os.FileMode, user *ChownOpt, tm *time.Time) erro
|
|||
return err
|
||||
}
|
||||
|
||||
if err := Chown(path, user); err != nil {
|
||||
if err := Chown(path, nil, user); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
17
vendor/github.com/tonistiigi/fsutil/copy/stat_bsd.go
generated
vendored
Normal file
17
vendor/github.com/tonistiigi/fsutil/copy/stat_bsd.go
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
// +build darwin freebsd netbsd openbsd
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// Returns the last-accessed time
|
||||
func StatAtime(st *syscall.Stat_t) syscall.Timespec {
|
||||
return st.Atimespec
|
||||
}
|
||||
|
||||
// Returns the last-modified time
|
||||
func StatMtime(st *syscall.Stat_t) syscall.Timespec {
|
||||
return st.Mtimespec
|
||||
}
|
17
vendor/github.com/tonistiigi/fsutil/copy/stat_sysv.go
generated
vendored
Normal file
17
vendor/github.com/tonistiigi/fsutil/copy/stat_sysv.go
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
// +build dragonfly linux solaris
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// Returns the last-accessed time
|
||||
func StatAtime(st *syscall.Stat_t) syscall.Timespec {
|
||||
return st.Atim
|
||||
}
|
||||
|
||||
// Returns the last-modified time
|
||||
func StatMtime(st *syscall.Stat_t) syscall.Timespec {
|
||||
return st.Mtim
|
||||
}
|
2
vendor/github.com/tonistiigi/fsutil/go.mod
generated
vendored
2
vendor/github.com/tonistiigi/fsutil/go.mod
generated
vendored
|
@ -2,8 +2,6 @@ module github.com/tonistiigi/fsutil
|
|||
|
||||
require (
|
||||
github.com/Microsoft/go-winio v0.4.11 // indirect
|
||||
github.com/Microsoft/hcsshim v0.8.5 // indirect
|
||||
github.com/containerd/containerd v1.2.4
|
||||
github.com/containerd/continuity v0.0.0-20181001140422-bd77b46c8352
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/docker/docker v0.0.0-20180531152204-71cd53e4a197
|
||||
|
|
Loading…
Reference in a new issue