From af902caeaa32c916a0e2fa4d0656d6cd08acf2c5 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Thu, 27 Jun 2024 20:24:41 -0700 Subject: [PATCH] vendor: update buildkit to 8397d0b9 Signed-off-by: Tonis Tiigi --- go.mod | 2 +- go.sum | 4 ++-- .../frontend/dockerfile/linter/linter.go | 8 ++++++- .../buildkit/session/filesync/diffcopy.go | 4 ---- .../session/filesync/diffcopy_unix.go | 13 ++++++++++++ .../session/filesync/diffcopy_windows.go | 21 +++++++++++++++++++ vendor/modules.txt | 2 +- 7 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 vendor/github.com/moby/buildkit/session/filesync/diffcopy_unix.go create mode 100644 vendor/github.com/moby/buildkit/session/filesync/diffcopy_windows.go diff --git a/go.mod b/go.mod index 2a591efb..e45c34ca 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/hashicorp/hcl/v2 v2.20.1 github.com/in-toto/in-toto-golang v0.5.0 github.com/mitchellh/hashstructure/v2 v2.0.2 - github.com/moby/buildkit v0.14.1-0.20240625190127-aaaf86e5470b // master (v0.15-dev) + github.com/moby/buildkit v0.14.1-0.20240627230018-8397d0b9f756 github.com/moby/sys/mountinfo v0.7.1 github.com/moby/sys/signal v0.7.0 github.com/morikuni/aec v1.0.0 diff --git a/go.sum b/go.sum index 212b62b3..f48a8a79 100644 --- a/go.sum +++ b/go.sum @@ -300,8 +300,8 @@ github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/z github.com/mitchellh/mapstructure v0.0.0-20150613213606-2caf8efc9366/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moby/buildkit v0.14.1-0.20240625190127-aaaf86e5470b h1:x1TdL3kMOFi3qdlAYBPVf4YzPD8fIZAjIjGfRycru8Q= -github.com/moby/buildkit v0.14.1-0.20240625190127-aaaf86e5470b/go.mod h1:ui4ZkNR6Z3kVMVqLY5JcoWcmlibi7TJL3bdzikvs5Yw= +github.com/moby/buildkit v0.14.1-0.20240627230018-8397d0b9f756 h1:mA5DQAEH2HFsn0hxzK5kDLF/JZe87tbMmMD3KTsCY7c= +github.com/moby/buildkit v0.14.1-0.20240627230018-8397d0b9f756/go.mod h1:ui4ZkNR6Z3kVMVqLY5JcoWcmlibi7TJL3bdzikvs5Yw= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/linter/linter.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/linter/linter.go index 1fed40ef..da94cbc9 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/linter/linter.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/linter/linter.go @@ -39,7 +39,7 @@ func New(config *Config) *Linter { } func (lc *Linter) Run(rule LinterRuleI, location []parser.Range, txt ...string) { - if lc == nil || lc.Warn == nil || lc.SkipAll { + if lc == nil || lc.Warn == nil || lc.SkipAll || rule.IsDeprecated() { return } rulename := rule.RuleName() @@ -71,11 +71,13 @@ func (lc *Linter) Error() error { type LinterRuleI interface { RuleName() string Run(warn LintWarnFunc, location []parser.Range, txt ...string) + IsDeprecated() bool } type LinterRule[F any] struct { Name string Description string + Deprecated bool URL string Format F } @@ -92,6 +94,10 @@ func (rule *LinterRule[F]) Run(warn LintWarnFunc, location []parser.Range, txt . warn(rule.Name, rule.Description, rule.URL, short, location) } +func (rule *LinterRule[F]) IsDeprecated() bool { + return rule.Deprecated +} + func LintFormatShort(rulename, msg string, line int) string { msg = fmt.Sprintf("%s: %s", rulename, msg) if line > 0 { diff --git a/vendor/github.com/moby/buildkit/session/filesync/diffcopy.go b/vendor/github.com/moby/buildkit/session/filesync/diffcopy.go index 56bffe53..5cc5fdc0 100644 --- a/vendor/github.com/moby/buildkit/session/filesync/diffcopy.go +++ b/vendor/github.com/moby/buildkit/session/filesync/diffcopy.go @@ -21,10 +21,6 @@ type Stream interface { RecvMsg(m interface{}) error } -func sendDiffCopy(stream Stream, fs fsutil.FS, progress progressCb) error { - return errors.WithStack(fsutil.Send(stream.Context(), stream, fs, progress)) -} - func newStreamWriter(stream grpc.ClientStream) io.WriteCloser { wc := &streamWriterCloser{ClientStream: stream} return &bufferedWriteCloser{Writer: bufio.NewWriter(wc), Closer: wc} diff --git a/vendor/github.com/moby/buildkit/session/filesync/diffcopy_unix.go b/vendor/github.com/moby/buildkit/session/filesync/diffcopy_unix.go new file mode 100644 index 00000000..d80489d0 --- /dev/null +++ b/vendor/github.com/moby/buildkit/session/filesync/diffcopy_unix.go @@ -0,0 +1,13 @@ +//go:build !windows +// +build !windows + +package filesync + +import ( + "github.com/pkg/errors" + "github.com/tonistiigi/fsutil" +) + +func sendDiffCopy(stream Stream, fs fsutil.FS, progress progressCb) error { + return errors.WithStack(fsutil.Send(stream.Context(), stream, fs, progress)) +} diff --git a/vendor/github.com/moby/buildkit/session/filesync/diffcopy_windows.go b/vendor/github.com/moby/buildkit/session/filesync/diffcopy_windows.go new file mode 100644 index 00000000..0054e75d --- /dev/null +++ b/vendor/github.com/moby/buildkit/session/filesync/diffcopy_windows.go @@ -0,0 +1,21 @@ +//go:build windows +// +build windows + +package filesync + +import ( + "github.com/Microsoft/go-winio" + "github.com/pkg/errors" + "github.com/tonistiigi/fsutil" +) + +func sendDiffCopy(stream Stream, fs fsutil.FS, progress progressCb) error { + // adding one SeBackupPrivilege to the process so as to be able + // to run the subsequent goroutines in fsutil.Send that need + // to copy over special Windows metadata files. + // TODO(profnandaa): need to cross-check that this cannot be + // exploited in any way. + winio.EnableProcessPrivileges([]string{winio.SeBackupPrivilege}) + defer winio.DisableProcessPrivileges([]string{winio.SeBackupPrivilege}) + return errors.WithStack(fsutil.Send(stream.Context(), stream, fs, progress)) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 1e1e89c9..8a080d77 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -515,7 +515,7 @@ github.com/mitchellh/go-wordwrap github.com/mitchellh/hashstructure/v2 # github.com/mitchellh/mapstructure v1.5.0 ## explicit; go 1.14 -# github.com/moby/buildkit v0.14.1-0.20240625190127-aaaf86e5470b +# github.com/moby/buildkit v0.14.1-0.20240627230018-8397d0b9f756 ## explicit; go 1.21 github.com/moby/buildkit/api/services/control github.com/moby/buildkit/api/types