From 7a54b6ee7e49d391af95229cb2753b18f19f37f3 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 14 May 2025 20:05:28 +0200 Subject: [PATCH] vendor: github.com/moby/buildkit v0.22.0-rc1 Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- go.mod | 4 +- go.sum | 12 +- tests/build.go | 5 +- .../github.com/moby/buildkit/client/client.go | 3 +- .../moby/buildkit/client/diskusage.go | 11 +- .../moby/buildkit/client/llb/definition.go | 2 +- .../moby/buildkit/client/llb/exec.go | 20 +- .../moby/buildkit/client/llb/source.go | 4 +- .../github.com/moby/buildkit/client/prune.go | 8 +- .../github.com/moby/buildkit/client/solve.go | 7 +- .../buildkit/cmd/buildkitd/config/config.go | 4 +- .../moby/buildkit/errdefs/internal.go | 10 +- .../buildkit/frontend/attestations/parse.go | 8 +- .../frontend/dockerfile/linter/linter.go | 2 +- .../frontend/dockerfile/parser/errors.go | 10 +- .../dockerfile/parser/line_parsers.go | 4 +- .../frontend/dockerfile/parser/parser.go | 6 +- .../buildkit/frontend/dockerfile/shell/lex.go | 28 +++ .../moby/buildkit/frontend/dockerui/attr.go | 8 +- .../moby/buildkit/frontend/dockerui/build.go | 32 +-- .../frontend/gateway/grpcclient/client.go | 2 +- .../moby/buildkit/frontend/gateway/pb/caps.go | 2 +- .../moby/buildkit/frontend/gateway/pb/exit.go | 2 +- .../session/auth/authprovider/authprovider.go | 7 +- .../buildkit/session/filesync/diffcopy.go | 10 +- .../buildkit/session/filesync/filesync.go | 4 +- .../github.com/moby/buildkit/session/group.go | 2 +- .../github.com/moby/buildkit/session/grpc.go | 2 +- .../moby/buildkit/session/grpchijack/dial.go | 3 +- .../moby/buildkit/session/sshforward/copy.go | 4 +- .../moby/buildkit/session/sshforward/ssh.go | 2 +- .../moby/buildkit/session/upload/upload.go | 2 +- .../buildkit/solver/errdefs/errdefs.pb.go | 189 +++++++++------ .../buildkit/solver/errdefs/errdefs.proto | 5 + .../solver/errdefs/errdefs_vtproto.pb.go | 220 ++++++++++++++++++ .../moby/buildkit/solver/errdefs/frontend.go | 50 ++++ .../{fronetendcap.go => frontendcap.go} | 2 +- .../moby/buildkit/solver/errdefs/solve.go | 2 +- .../moby/buildkit/solver/errdefs/source.go | 19 +- .../buildkit/solver/errdefs/subrequest.go | 2 +- .../buildkit/solver/result/attestation.go | 4 +- .../moby/buildkit/sourcepolicy/pb/json.go | 2 +- .../moby/buildkit/util/apicaps/caps.go | 7 +- .../buildkit/util/appcontext/appcontext.go | 4 +- .../util/appdefaults/appdefaults_windows.go | 5 +- .../moby/buildkit/util/contentutil/copy.go | 4 +- .../moby/buildkit/util/contentutil/fetcher.go | 4 +- .../moby/buildkit/util/disk/disk_freebsd.go | 2 +- .../util/flightcontrol/flightcontrol.go | 7 +- .../buildkit/util/grpcerrors/grpcerrors.go | 28 ++- .../buildkit/util/progress/multireader.go | 3 +- .../buildkit/util/progress/multiwriter.go | 6 +- .../moby/buildkit/util/progress/progress.go | 7 +- .../util/progress/progressui/colors.go | 8 +- .../util/progress/progressui/display.go | 28 ++- .../util/progress/progressui/printer.go | 2 +- .../moby/buildkit/util/stack/compress.go | 2 +- .../moby/buildkit/util/stack/stack.go | 12 +- .../util/testutil/dockerd/client/request.go | 9 +- .../buildkit/util/testutil/dockerd/daemon.go | 4 +- .../util/testutil/dockerd/daemon_unix.go | 11 + .../util/testutil/dockerd/daemon_windows.go | 7 + .../util/testutil/integration/registry.go | 2 +- .../buildkit/util/testutil/integration/run.go | 16 +- .../moby/buildkit/util/testutil/tar.go | 2 +- .../buildkit/util/testutil/workers/dockerd.go | 10 +- .../util/testutil/workers/util_unix.go | 11 + .../util/testutil/workers/util_windows.go | 16 ++ .../buildkit/util/tracing/detect/detect.go | 6 +- .../util/tracing/otlptracegrpc/client.go | 2 +- .../moby/buildkit/util/tracing/tracing.go | 17 +- .../github.com/tonistiigi/fsutil/stat_unix.go | 22 +- vendor/modules.txt | 4 +- 73 files changed, 723 insertions(+), 270 deletions(-) create mode 100644 vendor/github.com/moby/buildkit/solver/errdefs/frontend.go rename vendor/github.com/moby/buildkit/solver/errdefs/{fronetendcap.go => frontendcap.go} (91%) create mode 100644 vendor/github.com/moby/buildkit/util/testutil/dockerd/daemon_unix.go create mode 100644 vendor/github.com/moby/buildkit/util/testutil/dockerd/daemon_windows.go diff --git a/go.mod b/go.mod index c01fbd694..a1d0649c0 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/hashicorp/hcl/v2 v2.23.0 github.com/in-toto/in-toto-golang v0.5.0 github.com/mitchellh/hashstructure/v2 v2.0.2 - github.com/moby/buildkit v0.21.0 + github.com/moby/buildkit v0.22.0-rc1 github.com/moby/go-archive v0.1.0 github.com/moby/sys/atomicwriter v0.1.0 github.com/moby/sys/mountinfo v0.7.2 @@ -44,7 +44,7 @@ require ( github.com/spf13/cobra v1.9.1 github.com/spf13/pflag v1.0.6 github.com/stretchr/testify v1.10.0 - github.com/tonistiigi/fsutil v0.0.0-20250410151801-5b74a7ad7583 + github.com/tonistiigi/fsutil v0.0.0-20250417144416-3f76f8130144 github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 github.com/tonistiigi/jaeger-ui-rest v0.0.0-20250408171107-3dd17559e117 github.com/zclconf/go-cty v1.16.2 diff --git a/go.sum b/go.sum index 8611f9c7f..c598c08d1 100644 --- a/go.sum +++ b/go.sum @@ -253,8 +253,8 @@ github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZX github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4= github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE= github.com/mitchellh/mapstructure v0.0.0-20150613213606-2caf8efc9366/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/moby/buildkit v0.21.0 h1:+z4vVqgt0spLrOSxi4DLedRbIh2gbNVlZ5q4rsnNp60= -github.com/moby/buildkit v0.21.0/go.mod h1:mBq0D44uCyz2PdX8T/qym5LBbkBO3GGv0wqgX9ABYYw= +github.com/moby/buildkit v0.22.0-rc1 h1:Q47jZZws7+0WhucTcm35NRV8NcO6n1SwIikzfqcGKLo= +github.com/moby/buildkit v0.22.0-rc1/go.mod h1:j4pP5hxiTWcz7xuTK2cyxQislHl/N2WWHzOy43DlLJw= 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/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ= @@ -380,8 +380,8 @@ github.com/theupdateframework/notary v0.7.0 h1:QyagRZ7wlSpjT5N2qQAh/pN+DVqgekv4D github.com/theupdateframework/notary v0.7.0/go.mod h1:c9DRxcmhHmVLDay4/2fUYdISnHqbFDGRSlXPO0AhYWw= github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323 h1:r0p7fK56l8WPequOaR3i9LBqfPtEdXIQbUTzT55iqT4= github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323/go.mod h1:3Iuxbr0P7D3zUzBMAZB+ois3h/et0shEz0qApgHYGpY= -github.com/tonistiigi/fsutil v0.0.0-20250410151801-5b74a7ad7583 h1:mK+ZskNt7SG4dxfKIi27C7qHAQzyjAVt1iyTf0hmsNc= -github.com/tonistiigi/fsutil v0.0.0-20250410151801-5b74a7ad7583/go.mod h1:BKdcez7BiVtBvIcef90ZPc6ebqIWr4JWD7+EvLm6J98= +github.com/tonistiigi/fsutil v0.0.0-20250417144416-3f76f8130144 h1:k9tdF32oJYwtjzMx+D26M6eYiCaAPdJ7tyN7tF1oU5Q= +github.com/tonistiigi/fsutil v0.0.0-20250417144416-3f76f8130144/go.mod h1:BKdcez7BiVtBvIcef90ZPc6ebqIWr4JWD7+EvLm6J98= github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 h1:7I5c2Ig/5FgqkYOh/N87NzoyI9U15qUPXhDD8uCupv8= github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4/go.mod h1:278M4p8WsNh3n4a1eqiFcV2FGk7wE5fwUpUom9mK9lE= github.com/tonistiigi/jaeger-ui-rest v0.0.0-20250408171107-3dd17559e117 h1:XFwyh2JZwR5aiKLXHX2C1n0v5F11dCJpyGL1W/Cpl3U= @@ -390,8 +390,8 @@ github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/ github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk= github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab h1:H6aJ0yKQ0gF49Qb2z5hI1UHxSQt4JMyxebFR15KnApw= github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab/go.mod h1:ulncasL3N9uLrVann0m+CDlJKWsIAP34MPcOJF6VRvc= -github.com/vbatts/tar-split v0.11.6 h1:4SjTW5+PU11n6fZenf2IPoV8/tz3AaYHMWjf23envGs= -github.com/vbatts/tar-split v0.11.6/go.mod h1:dqKNtesIOr2j2Qv3W/cHjnvk9I8+G7oAkFDFN6TCBEI= +github.com/vbatts/tar-split v0.12.1 h1:CqKoORW7BUWBe7UL/iqTVvkTBOF8UvOMKOIZykxnnbo= +github.com/vbatts/tar-split v0.12.1/go.mod h1:eF6B6i6ftWQcDqEn3/iGFRFRo8cBIMSJVOpnNdfTMFA= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= diff --git a/tests/build.go b/tests/build.go index 1e40c290e..b635d10f8 100644 --- a/tests/build.go +++ b/tests/build.go @@ -518,7 +518,10 @@ func testBuildProgress(t *testing.T, sb integration.Sandbox) { // progress=tty cmd := buildxCmd(sb, withArgs("build", "--progress=tty", "--output=type=cacheonly", dir)) - f, err := pty.Start(cmd) + f, err := pty.StartWithSize(cmd, &pty.Winsize{ + Cols: 120, + Rows: 24, + }) require.NoError(t, err) buf := bytes.NewBuffer(nil) io.Copy(buf, f) diff --git a/vendor/github.com/moby/buildkit/client/client.go b/vendor/github.com/moby/buildkit/client/client.go index 2ca45ca5f..ff3b6669b 100644 --- a/vendor/github.com/moby/buildkit/client/client.go +++ b/vendor/github.com/moby/buildkit/client/client.go @@ -151,7 +151,8 @@ func New(ctx context.Context, address string, opts ...ClientOpt) (*Client, error gopts = append(gopts, grpc.WithStreamInterceptor(grpcerrors.StreamClientInterceptor)) gopts = append(gopts, customDialOptions...) - //nolint:staticcheck // ignore SA1019 NewClient has different behavior and needs to be tested + // ignore SA1019 NewClient has different behavior and needs to be tested + //nolint:staticcheck conn, err := grpc.DialContext(ctx, address, gopts...) if err != nil { return nil, errors.Wrapf(err, "failed to dial %q . make sure buildkitd is running", address) diff --git a/vendor/github.com/moby/buildkit/client/diskusage.go b/vendor/github.com/moby/buildkit/client/diskusage.go index a83815f4f..a690f4818 100644 --- a/vendor/github.com/moby/buildkit/client/diskusage.go +++ b/vendor/github.com/moby/buildkit/client/diskusage.go @@ -1,8 +1,9 @@ package client import ( + "cmp" "context" - "sort" + "slices" "time" controlapi "github.com/moby/buildkit/api/services/control" @@ -60,13 +61,9 @@ func (c *Client) DiskUsage(ctx context.Context, opts ...DiskUsageOption) ([]*Usa }) } - sort.Slice(du, func(i, j int) bool { - if du[i].Size == du[j].Size { - return du[i].ID > du[j].ID - } - return du[i].Size > du[j].Size + slices.SortFunc(du, func(a, b *UsageInfo) int { + return cmp.Or(cmp.Compare(a.Size, b.Size), cmp.Compare(a.ID, b.ID)) }) - return du, nil } diff --git a/vendor/github.com/moby/buildkit/client/llb/definition.go b/vendor/github.com/moby/buildkit/client/llb/definition.go index 3c9ee7320..73c8097ab 100644 --- a/vendor/github.com/moby/buildkit/client/llb/definition.go +++ b/vendor/github.com/moby/buildkit/client/llb/definition.go @@ -240,7 +240,7 @@ func (d *DefinitionOp) Inputs() []Output { d.mu.Unlock() inputs = append(inputs, &output{vertex: vtx, platform: platform, getIndex: func() (pb.OutputIndex, error) { - return pb.OutputIndex(vtx.index), nil + return vtx.index, nil }}) } diff --git a/vendor/github.com/moby/buildkit/client/llb/exec.go b/vendor/github.com/moby/buildkit/client/llb/exec.go index 7c8116ad7..cd86f6f7c 100644 --- a/vendor/github.com/moby/buildkit/client/llb/exec.go +++ b/vendor/github.com/moby/buildkit/client/llb/exec.go @@ -5,7 +5,7 @@ import ( _ "crypto/sha256" // for opencontainers/go-digest "fmt" "net" - "sort" + "slices" "strings" "github.com/moby/buildkit/solver/pb" @@ -143,8 +143,8 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, [] return "", nil, nil, nil, err } // make sure mounts are sorted - sort.Slice(e.mounts, func(i, j int) bool { - return e.mounts[i].target < e.mounts[j].target + slices.SortFunc(e.mounts, func(a, b *mount) int { + return strings.Compare(a.target, b.target) }) env, err := getEnv(e.base)(ctx, c) @@ -170,7 +170,10 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, [] } else if e.constraints.Platform != nil { os = e.constraints.Platform.OS } - env = env.SetDefault("PATH", system.DefaultPathEnv(os)) + // don't set PATH on Windows. #5445 + if os != "windows" { + env = env.SetDefault("PATH", system.DefaultPathEnv(os)) + } } else { addCap(&e.constraints, pb.CapExecMetaSetsDefaultPath) } @@ -477,10 +480,9 @@ func (e *ExecOp) Inputs() (inputs []Output) { // make sure mounts are sorted // the same sort occurs in (*ExecOp).Marshal, and this // sort must be the same - sort.Slice(e.mounts, func(i int, j int) bool { - return e.mounts[i].target < e.mounts[j].target + slices.SortFunc(e.mounts, func(a, b *mount) int { + return strings.Compare(a.target, b.target) }) - seen := map[Output]struct{}{} for _, m := range e.mounts { if m.source != nil { @@ -497,8 +499,8 @@ func (e *ExecOp) Inputs() (inputs []Output) { func (e *ExecOp) getMountIndexFn(m *mount) func() (pb.OutputIndex, error) { return func() (pb.OutputIndex, error) { // make sure mounts are sorted - sort.Slice(e.mounts, func(i, j int) bool { - return e.mounts[i].target < e.mounts[j].target + slices.SortFunc(e.mounts, func(a, b *mount) int { + return strings.Compare(a.target, b.target) }) i := 0 diff --git a/vendor/github.com/moby/buildkit/client/llb/source.go b/vendor/github.com/moby/buildkit/client/llb/source.go index 443a0cc6b..cb1f47206 100644 --- a/vendor/github.com/moby/buildkit/client/llb/source.go +++ b/vendor/github.com/moby/buildkit/client/llb/source.go @@ -136,7 +136,7 @@ func Image(ref string, opts ...ImageOption) State { } else if info.metaResolver != nil { if _, ok := r.(reference.Digested); ok || !info.resolveDigest { return NewState(src.Output()).Async(func(ctx context.Context, st State, c *Constraints) (State, error) { - p := info.Constraints.Platform + p := info.Platform if p == nil { p = c.Platform } @@ -153,7 +153,7 @@ func Image(ref string, opts ...ImageOption) State { }) } return Scratch().Async(func(ctx context.Context, _ State, c *Constraints) (State, error) { - p := info.Constraints.Platform + p := info.Platform if p == nil { p = c.Platform } diff --git a/vendor/github.com/moby/buildkit/client/prune.go b/vendor/github.com/moby/buildkit/client/prune.go index 1d6d02df0..0b4ea2706 100644 --- a/vendor/github.com/moby/buildkit/client/prune.go +++ b/vendor/github.com/moby/buildkit/client/prune.go @@ -18,9 +18,9 @@ func (c *Client) Prune(ctx context.Context, ch chan UsageInfo, opts ...PruneOpti req := &controlapi.PruneRequest{ Filter: info.Filter, KeepDuration: int64(info.KeepDuration), - ReservedSpace: int64(info.ReservedSpace), - MaxUsedSpace: int64(info.MaxUsedSpace), - MinFreeSpace: int64(info.MinFreeSpace), + ReservedSpace: info.ReservedSpace, + MaxUsedSpace: info.MaxUsedSpace, + MinFreeSpace: info.MinFreeSpace, } if info.All { req.All = true @@ -33,7 +33,7 @@ func (c *Client) Prune(ctx context.Context, ch chan UsageInfo, opts ...PruneOpti for { d, err := cl.Recv() if err != nil { - if err == io.EOF { + if errors.Is(err, io.EOF) { return nil } return err diff --git a/vendor/github.com/moby/buildkit/client/solve.go b/vendor/github.com/moby/buildkit/client/solve.go index f3e97b3aa..603211261 100644 --- a/vendor/github.com/moby/buildkit/client/solve.go +++ b/vendor/github.com/moby/buildkit/client/solve.go @@ -322,7 +322,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG for { resp, err := stream.Recv() if err != nil { - if err == io.EOF { + if errors.Is(err, io.EOF) { return nil } return errors.Wrap(err, "failed to receive status") @@ -356,7 +356,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG return nil, err } var manifestDesc ocispecs.Descriptor - if err = json.Unmarshal([]byte(manifestDescDt), &manifestDesc); err != nil { + if err = json.Unmarshal(manifestDescDt, &manifestDesc); err != nil { return nil, err } for _, storePath := range storesToUpdate { @@ -402,8 +402,7 @@ func prepareSyncedFiles(def *llb.Definition, localMounts map[string]fsutil.FS) ( return nil, errors.Wrap(err, "failed to parse llb proto op") } if src := op.GetSource(); src != nil { - if strings.HasPrefix(src.Identifier, "local://") { - name := strings.TrimPrefix(src.Identifier, "local://") + if name, ok := strings.CutPrefix(src.Identifier, "local://"); ok { mount, ok := localMounts[name] if !ok { return nil, errors.Errorf("local directory %s not enabled", name) diff --git a/vendor/github.com/moby/buildkit/cmd/buildkitd/config/config.go b/vendor/github.com/moby/buildkit/cmd/buildkitd/config/config.go index a8be23428..156f3f3b5 100644 --- a/vendor/github.com/moby/buildkit/cmd/buildkitd/config/config.go +++ b/vendor/github.com/moby/buildkit/cmd/buildkitd/config/config.go @@ -104,7 +104,7 @@ type NetworkConfig struct { type OCIConfig struct { Enabled *bool `toml:"enabled"` Labels map[string]string `toml:"labels"` - Platforms []string `toml:"platforms"` + Platforms []string `toml:"platforms,omitempty"` Snapshotter string `toml:"snapshotter"` Rootless bool `toml:"rootless"` NoProcessSandbox bool `toml:"noProcessSandbox"` @@ -138,7 +138,7 @@ type ContainerdConfig struct { Address string `toml:"address"` Enabled *bool `toml:"enabled"` Labels map[string]string `toml:"labels"` - Platforms []string `toml:"platforms"` + Platforms []string `toml:"platforms,omitempty"` Namespace string `toml:"namespace"` Runtime ContainerdRuntime `toml:"runtime"` GCConfig diff --git a/vendor/github.com/moby/buildkit/errdefs/internal.go b/vendor/github.com/moby/buildkit/errdefs/internal.go index 24cea7e33..bf03d0f99 100644 --- a/vendor/github.com/moby/buildkit/errdefs/internal.go +++ b/vendor/github.com/moby/buildkit/errdefs/internal.go @@ -5,13 +5,13 @@ import ( "syscall" ) -type internalErr struct { +type internalError struct { error } -func (internalErr) System() {} +func (internalError) System() {} -func (err internalErr) Unwrap() error { +func (err internalError) Unwrap() error { return err.error } @@ -19,13 +19,13 @@ type system interface { System() } -var _ system = internalErr{} +var _ system = internalError{} func Internal(err error) error { if err == nil { return nil } - return internalErr{err} + return internalError{err} } func IsInternal(err error) bool { diff --git a/vendor/github.com/moby/buildkit/frontend/attestations/parse.go b/vendor/github.com/moby/buildkit/frontend/attestations/parse.go index a3d5ff5db..2b2ed2499 100644 --- a/vendor/github.com/moby/buildkit/frontend/attestations/parse.go +++ b/vendor/github.com/moby/buildkit/frontend/attestations/parse.go @@ -43,12 +43,12 @@ func Validate(values map[string]map[string]string) (map[string]map[string]string func Parse(values map[string]string) (map[string]map[string]string, error) { attests := make(map[string]string) for k, v := range values { - if strings.HasPrefix(k, "attest:") { - attests[strings.ToLower(strings.TrimPrefix(k, "attest:"))] = v + if after, ok := strings.CutPrefix(k, "attest:"); ok { + attests[strings.ToLower(after)] = v continue } - if strings.HasPrefix(k, "build-arg:BUILDKIT_ATTEST_") { - attests[strings.ToLower(strings.TrimPrefix(k, "build-arg:BUILDKIT_ATTEST_"))] = v + if after, ok := strings.CutPrefix(k, "build-arg:BUILDKIT_ATTEST_"); ok { + attests[strings.ToLower(after)] = v continue } } 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 890acc53b..405f6923d 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/linter/linter.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/linter/linter.go @@ -55,7 +55,7 @@ func (lc *Linter) Run(rule LinterRuleI, location []parser.Range, txt ...string) rulename := rule.RuleName() if rule.IsExperimental() { _, experimentalOk := lc.ExperimentalRules[rulename] - if !(lc.ExperimentalAll || experimentalOk) { + if !lc.ExperimentalAll && !experimentalOk { return } } else { diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/parser/errors.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/parser/errors.go index 08a40c5d4..b3bcf2ae8 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/parser/errors.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/parser/errors.go @@ -5,14 +5,14 @@ import ( "github.com/pkg/errors" ) -// ErrorLocation gives a location in source code that caused the error -type ErrorLocation struct { +// LocationError gives a location in source code that caused the error +type LocationError struct { Locations [][]Range error } // Unwrap unwraps to the next error -func (e *ErrorLocation) Unwrap() error { +func (e *LocationError) Unwrap() error { return e.error } @@ -45,7 +45,7 @@ func setLocation(err error, location []Range, add bool) error { if err == nil { return nil } - var el *ErrorLocation + var el *LocationError if errors.As(err, &el) { if add { el.Locations = append(el.Locations, location) @@ -54,7 +54,7 @@ func setLocation(err error, location []Range, add bool) error { } return err } - return stack.Enable(&ErrorLocation{ + return stack.Enable(&LocationError{ error: err, Locations: [][]Range{location}, }) diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/parser/line_parsers.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/parser/line_parsers.go index 104978164..eb86e73b4 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/parser/line_parsers.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/parser/line_parsers.go @@ -318,7 +318,7 @@ func parseMaybeJSON(rest string, d *directives) (*Node, map[string]bool, error) if err == nil { return node, attrs, nil } - if err == errDockerfileNotStringArray { + if errors.Is(err, errDockerfileNotStringArray) { return nil, nil, err } @@ -336,7 +336,7 @@ func parseMaybeJSONToList(rest string, d *directives) (*Node, map[string]bool, e if err == nil { return node, attrs, nil } - if err == errDockerfileNotStringArray { + if errors.Is(err, errDockerfileNotStringArray) { return nil, nil, err } diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/parser/parser.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/parser/parser.go index f1667a108..2f0da0222 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/parser/parser.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/parser/parser.go @@ -114,7 +114,7 @@ type Heredoc struct { var ( dispatch map[string]func(string, *directives) (*Node, map[string]bool, error) reWhitespace = regexp.MustCompile(`[\t\v\f\r ]+`) - reHeredoc = regexp.MustCompile(`^(\d*)<<(-?)([^<]*)$`) + reHeredoc = regexp.MustCompile(`^(\d*)<<(-?)\s*([^<]*)$`) reLeadingTabs = regexp.MustCompile(`(?m)^\t+`) ) @@ -556,8 +556,8 @@ func scanLines(data []byte, atEOF bool) (advance int, token []byte, err error) { } func handleScannerError(err error) error { - switch err { - case bufio.ErrTooLong: + switch { + case errors.Is(err, bufio.ErrTooLong): return errors.Errorf("dockerfile line greater than max allowed size of %d", bufio.MaxScanTokenSize-1) default: return err diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/shell/lex.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/shell/lex.go index 18da29334..b8a307a06 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/shell/lex.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/shell/lex.go @@ -177,6 +177,7 @@ func (sw *shellWord) processStopOn(stopChar rune, rawEscapes bool) (string, []st // no need to initialize all the time var charFuncMapping = map[rune]func() (string, error){ '$': sw.processDollar, + '<': sw.processPossibleHeredoc, } if !sw.SkipProcessQuotes { charFuncMapping['\''] = sw.processSingleQuote @@ -512,6 +513,25 @@ func (sw *shellWord) processName() string { return name.String() } +func (sw *shellWord) processPossibleHeredoc() (string, error) { + sw.scanner.Next() + if sw.scanner.Peek() != '<' { + return "<", nil // not a heredoc + } + sw.scanner.Next() + + // heredoc might have whitespace between << and word terminator + var space bytes.Buffer + nextCh := sw.scanner.Peek() + for isWhitespace(nextCh) { + space.WriteRune(nextCh) + sw.scanner.Next() + nextCh = sw.scanner.Peek() + } + result := "<<" + space.String() + return result, nil +} + // isSpecialParam checks if the provided character is a special parameters, // as defined in http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_05_02 func isSpecialParam(char rune) bool { @@ -677,3 +697,11 @@ func trimSuffix(pattern, word string, greedy bool) (string, error) { } return reverseString(str), nil } + +func isWhitespace(r rune) bool { + switch r { + case '\t', '\r', ' ': + return true + } + return false +} diff --git a/vendor/github.com/moby/buildkit/frontend/dockerui/attr.go b/vendor/github.com/moby/buildkit/frontend/dockerui/attr.go index 259100b46..e06d70e20 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerui/attr.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerui/attr.go @@ -128,8 +128,8 @@ func parseSourceDateEpoch(v string) (*time.Time, error) { func parseLocalSessionIDs(opt map[string]string) map[string]string { m := map[string]string{} for k, v := range opt { - if strings.HasPrefix(k, localSessionIDPrefix) { - m[strings.TrimPrefix(k, localSessionIDPrefix)] = v + if after, ok := strings.CutPrefix(k, localSessionIDPrefix); ok { + m[after] = v } } return m @@ -138,8 +138,8 @@ func parseLocalSessionIDs(opt map[string]string) map[string]string { func filter(opt map[string]string, key string) map[string]string { m := map[string]string{} for k, v := range opt { - if strings.HasPrefix(k, key) { - m[strings.TrimPrefix(k, key)] = v + if after, ok := strings.CutPrefix(k, key); ok { + m[after] = v } } return m diff --git a/vendor/github.com/moby/buildkit/frontend/dockerui/build.go b/vendor/github.com/moby/buildkit/frontend/dockerui/build.go index fe2dbd05d..233329b61 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerui/build.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerui/build.go @@ -22,7 +22,6 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro targets := make([]*ocispecs.Platform, 0, len(bc.TargetPlatforms)) for _, p := range bc.TargetPlatforms { - p := p targets = append(targets, &p) } if len(targets) == 0 { @@ -61,16 +60,12 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro } else { p = platforms.DefaultSpec() } - - k := platforms.FormatAll(p) - p = extendWindowsPlatform(p, img.Platform) - p = platforms.Normalize(p) - + expPlat := makeExportPlatform(p, img.Platform) if bc.MultiPlatformRequested { - res.AddRef(k, ref) - res.AddMeta(fmt.Sprintf("%s/%s", exptypes.ExporterImageConfigKey, k), config) + res.AddRef(expPlat.ID, ref) + res.AddMeta(fmt.Sprintf("%s/%s", exptypes.ExporterImageConfigKey, expPlat.ID), config) if len(baseConfig) > 0 { - res.AddMeta(fmt.Sprintf("%s/%s", exptypes.ExporterImageBaseConfigKey, k), baseConfig) + res.AddMeta(fmt.Sprintf("%s/%s", exptypes.ExporterImageBaseConfigKey, expPlat.ID), baseConfig) } } else { res.SetRef(ref) @@ -79,10 +74,7 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro res.AddMeta(exptypes.ExporterImageBaseConfigKey, baseConfig) } } - expPlatforms.Platforms[i] = exptypes.Platform{ - ID: k, - Platform: p, - } + expPlatforms.Platforms[i] = expPlat return nil }) } @@ -113,7 +105,6 @@ func (rb *ResultBuilder) Finalize() (*client.Result, error) { func (rb *ResultBuilder) EachPlatform(ctx context.Context, fn func(ctx context.Context, id string, p ocispecs.Platform) error) error { eg, ctx := errgroup.WithContext(ctx) for _, p := range rb.expPlatforms.Platforms { - p := p eg.Go(func() error { return fn(ctx, p.ID, p.Platform) }) @@ -133,3 +124,16 @@ func extendWindowsPlatform(p, imgP ocispecs.Platform) ocispecs.Platform { } return p } + +func makeExportPlatform(p, imgP ocispecs.Platform) exptypes.Platform { + p = platforms.Normalize(p) + exp := exptypes.Platform{ + ID: platforms.FormatAll(p), + } + if p.OS == "windows" { + p = extendWindowsPlatform(p, imgP) + p = platforms.Normalize(p) + } + exp.Platform = p + return exp +} diff --git a/vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go b/vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go index 615700f51..93fee1262 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go @@ -44,7 +44,7 @@ type GrpcClient interface { func New(ctx context.Context, opts map[string]string, session, product string, c pb.LLBBridgeClient, w []client.WorkerInfo) (GrpcClient, error) { pingCtx, pingCancel := context.WithCancelCause(ctx) - pingCtx, _ = context.WithTimeoutCause(pingCtx, 15*time.Second, errors.WithStack(context.DeadlineExceeded)) + pingCtx, _ = context.WithTimeoutCause(pingCtx, 15*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet defer pingCancel(errors.WithStack(context.Canceled)) resp, err := c.Ping(pingCtx, &pb.PingRequest{}) if err != nil { diff --git a/vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go b/vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go index 006aeee2e..7e43259e2 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go @@ -1,4 +1,4 @@ -package moby_buildkit_v1_frontend //nolint:revive +package moby_buildkit_v1_frontend //nolint:revive,staticcheck import "github.com/moby/buildkit/util/apicaps" diff --git a/vendor/github.com/moby/buildkit/frontend/gateway/pb/exit.go b/vendor/github.com/moby/buildkit/frontend/gateway/pb/exit.go index d978bfa66..57007185c 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/pb/exit.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/pb/exit.go @@ -1,4 +1,4 @@ -package moby_buildkit_v1_frontend //nolint:revive +package moby_buildkit_v1_frontend //nolint:revive,staticcheck import ( "fmt" diff --git a/vendor/github.com/moby/buildkit/session/auth/authprovider/authprovider.go b/vendor/github.com/moby/buildkit/session/auth/authprovider/authprovider.go index 54e458e53..88fe7d02b 100644 --- a/vendor/github.com/moby/buildkit/session/auth/authprovider/authprovider.go +++ b/vendor/github.com/moby/buildkit/session/auth/authprovider/authprovider.go @@ -8,6 +8,7 @@ import ( "crypto/tls" "crypto/x509" "fmt" + "net/http" "os" "runtime" "strconv" @@ -20,7 +21,7 @@ import ( "github.com/docker/cli/cli/config" "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/cli/config/types" - http "github.com/hashicorp/go-cleanhttp" + cleanhttp "github.com/hashicorp/go-cleanhttp" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/auth" "github.com/moby/buildkit/util/progress/progresswriter" @@ -125,7 +126,7 @@ func (ap *authProvider) FetchToken(ctx context.Context, req *auth.FetchTokenRequ httpClient := tracing.DefaultClient if tc, err := ap.tlsConfig(req.Host); err == nil && tc != nil { - transport := http.DefaultTransport() + transport := cleanhttp.DefaultTransport() transport.TLSClientConfig = tc httpClient.Transport = tracing.NewTransport(transport) } @@ -151,7 +152,7 @@ func (ap *authProvider) FetchToken(ctx context.Context, req *auth.FetchTokenRequ // Registries without support for POST may return 404 for POST /v2/token. // As of September 2017, GCR is known to return 404. // As of February 2018, JFrog Artifactory is known to return 401. - if (errStatus.StatusCode == 405 && to.Username != "") || errStatus.StatusCode == 404 || errStatus.StatusCode == 401 { + if (errStatus.StatusCode == http.StatusMethodNotAllowed && to.Username != "") || errStatus.StatusCode == http.StatusNotFound || errStatus.StatusCode == http.StatusUnauthorized { resp, err := authutil.FetchToken(ctx, httpClient, nil, to) if err != nil { return nil, err diff --git a/vendor/github.com/moby/buildkit/session/filesync/diffcopy.go b/vendor/github.com/moby/buildkit/session/filesync/diffcopy.go index 5176b5c03..5e8b40b93 100644 --- a/vendor/github.com/moby/buildkit/session/filesync/diffcopy.go +++ b/vendor/github.com/moby/buildkit/session/filesync/diffcopy.go @@ -32,7 +32,7 @@ type bufferedWriteCloser struct { } func (bwc *bufferedWriteCloser) Close() error { - if err := bwc.Writer.Flush(); err != nil { + if err := bwc.Flush(); err != nil { return errors.WithStack(err) } return bwc.Closer.Close() @@ -59,10 +59,10 @@ func (wc *streamWriterCloser) Write(dt []byte) (int, error) { return n1 + n2, nil } - if err := wc.ClientStream.SendMsg(&BytesMessage{Data: dt}); err != nil { + if err := wc.SendMsg(&BytesMessage{Data: dt}); err != nil { // SendMsg return EOF on remote errors if errors.Is(err, io.EOF) { - if err := errors.WithStack(wc.ClientStream.RecvMsg(struct{}{})); err != nil { + if err := errors.WithStack(wc.RecvMsg(struct{}{})); err != nil { return 0, err } } @@ -72,12 +72,12 @@ func (wc *streamWriterCloser) Write(dt []byte) (int, error) { } func (wc *streamWriterCloser) Close() error { - if err := wc.ClientStream.CloseSend(); err != nil { + if err := wc.CloseSend(); err != nil { return errors.WithStack(err) } // block until receiver is done var bm BytesMessage - if err := wc.ClientStream.RecvMsg(&bm); err != io.EOF { + if err := wc.RecvMsg(&bm); !errors.Is(err, io.EOF) { return errors.WithStack(err) } return nil diff --git a/vendor/github.com/moby/buildkit/session/filesync/filesync.go b/vendor/github.com/moby/buildkit/session/filesync/filesync.go index 2a402e445..230493f16 100644 --- a/vendor/github.com/moby/buildkit/session/filesync/filesync.go +++ b/vendor/github.com/moby/buildkit/session/filesync/filesync.go @@ -336,8 +336,8 @@ func (sp *SyncTarget) DiffCopy(stream FileSend_DiffCopyServer) (err error) { opts, _ := metadata.FromIncomingContext(stream.Context()) // if no metadata continue with empty object md := map[string]string{} for k, v := range opts { - if strings.HasPrefix(k, keyExporterMetaPrefix) { - md[strings.TrimPrefix(k, keyExporterMetaPrefix)] = strings.Join(v, ",") + if after, ok0 := strings.CutPrefix(k, keyExporterMetaPrefix); ok0 { + md[after] = strings.Join(v, ",") } } wc, err := f(md) diff --git a/vendor/github.com/moby/buildkit/session/group.go b/vendor/github.com/moby/buildkit/session/group.go index 66d18fcc7..14e02eb7b 100644 --- a/vendor/github.com/moby/buildkit/session/group.go +++ b/vendor/github.com/moby/buildkit/session/group.go @@ -73,7 +73,7 @@ func (sm *Manager) Any(ctx context.Context, g Group, f func(context.Context, str } timeoutCtx, cancel := context.WithCancelCause(ctx) - timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 5*time.Second, errors.WithStack(context.DeadlineExceeded)) + timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 5*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet defer func() { cancel(errors.WithStack(context.Canceled)) }() c, err := sm.Get(timeoutCtx, id, false) if err != nil { diff --git a/vendor/github.com/moby/buildkit/session/grpc.go b/vendor/github.com/moby/buildkit/session/grpc.go index c207e5dde..d177fd54e 100644 --- a/vendor/github.com/moby/buildkit/session/grpc.go +++ b/vendor/github.com/moby/buildkit/session/grpc.go @@ -94,7 +94,7 @@ func monitorHealth(ctx context.Context, cc *grpc.ClientConn, cancelConn func(err timeout := time.Duration(math.Max(float64(defaultHealthcheckDuration), float64(lastHealthcheckDuration)*1.5)) ctx, cancel := context.WithCancelCause(ctx) - ctx, _ = context.WithTimeoutCause(ctx, timeout, errors.WithStack(context.DeadlineExceeded)) + ctx, _ = context.WithTimeoutCause(ctx, timeout, errors.WithStack(context.DeadlineExceeded)) //nolint:govet _, err := healthClient.Check(ctx, &grpc_health_v1.HealthCheckRequest{}) cancel(errors.WithStack(context.Canceled)) diff --git a/vendor/github.com/moby/buildkit/session/grpchijack/dial.go b/vendor/github.com/moby/buildkit/session/grpchijack/dial.go index 019c2bbfe..39d78be0d 100644 --- a/vendor/github.com/moby/buildkit/session/grpchijack/dial.go +++ b/vendor/github.com/moby/buildkit/session/grpchijack/dial.go @@ -2,6 +2,7 @@ package grpchijack import ( "context" + "errors" "io" "net" "strings" @@ -112,7 +113,7 @@ func (c *conn) Close() (err error) { m.Data = c.buf err = c.stream.RecvMsg(m) if err != nil { - if err != io.EOF { + if !errors.Is(err, io.EOF) { c.readMu.Unlock() return } diff --git a/vendor/github.com/moby/buildkit/session/sshforward/copy.go b/vendor/github.com/moby/buildkit/session/sshforward/copy.go index 902063c5d..506236cd6 100644 --- a/vendor/github.com/moby/buildkit/session/sshforward/copy.go +++ b/vendor/github.com/moby/buildkit/session/sshforward/copy.go @@ -21,7 +21,7 @@ func Copy(ctx context.Context, conn io.ReadWriteCloser, stream Stream, closeStre p := &BytesMessage{} for { if err := stream.RecvMsg(p); err != nil { - if err == io.EOF { + if errors.Is(err, io.EOF) { // indicates client performed CloseSend, but they may still be // reading data if closeWriter, ok := conn.(interface { @@ -55,7 +55,7 @@ func Copy(ctx context.Context, conn io.ReadWriteCloser, stream Stream, closeStre buf := make([]byte, 32*1024) n, err := conn.Read(buf) switch { - case err == io.EOF: + case errors.Is(err, io.EOF): if closeStream != nil { closeStream() } diff --git a/vendor/github.com/moby/buildkit/session/sshforward/ssh.go b/vendor/github.com/moby/buildkit/session/sshforward/ssh.go index 8a041b311..7cd257bc3 100644 --- a/vendor/github.com/moby/buildkit/session/sshforward/ssh.go +++ b/vendor/github.com/moby/buildkit/session/sshforward/ssh.go @@ -40,7 +40,7 @@ func (s *server) run(ctx context.Context, l net.Listener, id string) error { opts := make(map[string][]string) opts[KeySSHID] = []string{id} - ctx = metadata.NewOutgoingContext(ctx, opts) + ctx := metadata.NewOutgoingContext(ctx, opts) stream, err := client.ForwardAgent(ctx) if err != nil { diff --git a/vendor/github.com/moby/buildkit/session/upload/upload.go b/vendor/github.com/moby/buildkit/session/upload/upload.go index e3fce5c1c..30e44eb38 100644 --- a/vendor/github.com/moby/buildkit/session/upload/upload.go +++ b/vendor/github.com/moby/buildkit/session/upload/upload.go @@ -42,7 +42,7 @@ func (u *Upload) WriteTo(w io.Writer) (int64, error) { for { var bm BytesMessage if err := u.cc.RecvMsg(&bm); err != nil { - if err == io.EOF { + if errors.Is(err, io.EOF) { return n, nil } return n, errors.WithStack(err) diff --git a/vendor/github.com/moby/buildkit/solver/errdefs/errdefs.pb.go b/vendor/github.com/moby/buildkit/solver/errdefs/errdefs.pb.go index e94043395..ff9298e30 100644 --- a/vendor/github.com/moby/buildkit/solver/errdefs/errdefs.pb.go +++ b/vendor/github.com/moby/buildkit/solver/errdefs/errdefs.pb.go @@ -119,6 +119,59 @@ func (x *Source) GetRanges() []*pb.Range { return nil } +type Frontend struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // frontend name e.g. dockerfile.v0 or gateway.v0 + Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` // used by the gateway frontend to identify the source, which corresponds to the image name +} + +func (x *Frontend) Reset() { + *x = Frontend{} + mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Frontend) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Frontend) ProtoMessage() {} + +func (x *Frontend) ProtoReflect() protoreflect.Message { + mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Frontend.ProtoReflect.Descriptor instead. +func (*Frontend) Descriptor() ([]byte, []int) { + return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{2} +} + +func (x *Frontend) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Frontend) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + type FrontendCap struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -129,7 +182,7 @@ type FrontendCap struct { func (x *FrontendCap) Reset() { *x = FrontendCap{} - mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[2] + mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -141,7 +194,7 @@ func (x *FrontendCap) String() string { func (*FrontendCap) ProtoMessage() {} func (x *FrontendCap) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[2] + mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -154,7 +207,7 @@ func (x *FrontendCap) ProtoReflect() protoreflect.Message { // Deprecated: Use FrontendCap.ProtoReflect.Descriptor instead. func (*FrontendCap) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{2} + return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{3} } func (x *FrontendCap) GetName() string { @@ -174,7 +227,7 @@ type Subrequest struct { func (x *Subrequest) Reset() { *x = Subrequest{} - mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[3] + mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -186,7 +239,7 @@ func (x *Subrequest) String() string { func (*Subrequest) ProtoMessage() {} func (x *Subrequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[3] + mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -199,7 +252,7 @@ func (x *Subrequest) ProtoReflect() protoreflect.Message { // Deprecated: Use Subrequest.ProtoReflect.Descriptor instead. func (*Subrequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{3} + return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{4} } func (x *Subrequest) GetName() string { @@ -227,7 +280,7 @@ type Solve struct { func (x *Solve) Reset() { *x = Solve{} - mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[4] + mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -239,7 +292,7 @@ func (x *Solve) String() string { func (*Solve) ProtoMessage() {} func (x *Solve) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[4] + mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -252,7 +305,7 @@ func (x *Solve) ProtoReflect() protoreflect.Message { // Deprecated: Use Solve.ProtoReflect.Descriptor instead. func (*Solve) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{4} + return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{5} } func (x *Solve) GetInputIDs() []string { @@ -331,7 +384,7 @@ type FileAction struct { func (x *FileAction) Reset() { *x = FileAction{} - mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[5] + mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -343,7 +396,7 @@ func (x *FileAction) String() string { func (*FileAction) ProtoMessage() {} func (x *FileAction) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[5] + mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -356,7 +409,7 @@ func (x *FileAction) ProtoReflect() protoreflect.Message { // Deprecated: Use FileAction.ProtoReflect.Descriptor instead. func (*FileAction) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{5} + return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{6} } func (x *FileAction) GetIndex() int64 { @@ -377,7 +430,7 @@ type ContentCache struct { func (x *ContentCache) Reset() { *x = ContentCache{} - mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[6] + mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -389,7 +442,7 @@ func (x *ContentCache) String() string { func (*ContentCache) ProtoMessage() {} func (x *ContentCache) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[6] + mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -402,7 +455,7 @@ func (x *ContentCache) ProtoReflect() protoreflect.Message { // Deprecated: Use ContentCache.ProtoReflect.Descriptor instead. func (*ContentCache) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{6} + return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{7} } func (x *ContentCache) GetIndex() int64 { @@ -429,39 +482,42 @@ var file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDesc = []byte{ 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x21, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, - 0x73, 0x22, 0x21, 0x0a, 0x0b, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x43, 0x61, 0x70, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x0a, 0x0a, 0x53, 0x75, 0x62, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xbf, 0x02, 0x0a, 0x05, 0x53, 0x6f, 0x6c, 0x76, 0x65, - 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x49, 0x44, 0x73, 0x12, 0x1a, 0x0a, 0x08, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x73, 0x12, 0x16, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x70, 0x62, 0x2e, 0x4f, 0x70, 0x52, 0x02, 0x6f, 0x70, - 0x12, 0x29, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, - 0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x63, - 0x61, 0x63, 0x68, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x65, 0x72, 0x72, - 0x64, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x63, 0x68, - 0x65, 0x48, 0x00, 0x52, 0x05, 0x63, 0x61, 0x63, 0x68, 0x65, 0x12, 0x41, 0x0a, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x6f, 0x6c, 0x76, 0x65, 0x2e, - 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x3e, 0x0a, - 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x09, 0x0a, - 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x22, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x24, 0x0a, 0x0c, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x69, 0x6e, 0x64, - 0x65, 0x78, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6d, 0x6f, 0x62, 0x79, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x2f, 0x73, - 0x6f, 0x6c, 0x76, 0x65, 0x72, 0x2f, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x22, 0x36, 0x0a, 0x08, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x21, 0x0a, 0x0b, 0x46, 0x72, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x43, 0x61, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x0a, 0x0a, + 0x53, 0x75, 0x62, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xbf, + 0x02, 0x0a, 0x05, 0x53, 0x6f, 0x6c, 0x76, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x70, 0x75, + 0x74, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x70, 0x75, + 0x74, 0x49, 0x44, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x73, + 0x12, 0x16, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x70, + 0x62, 0x2e, 0x4f, 0x70, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x29, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x66, + 0x69, 0x6c, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x63, 0x61, 0x63, 0x68, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x63, 0x68, 0x65, 0x48, 0x00, 0x52, 0x05, 0x63, 0x61, 0x63, + 0x68, 0x65, 0x12, 0x41, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, + 0x73, 0x2e, 0x53, 0x6f, 0x6c, 0x76, 0x65, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x3e, 0x0a, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x22, 0x22, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, + 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x22, 0x24, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x43, + 0x61, 0x63, 0x68, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x6f, 0x62, 0x79, 0x2f, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x2f, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x72, 0x2f, 0x65, 0x72, + 0x72, 0x64, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -476,27 +532,28 @@ func file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP() [] return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescData } -var file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_goTypes = []any{ (*Vertex)(nil), // 0: errdefs.Vertex (*Source)(nil), // 1: errdefs.Source - (*FrontendCap)(nil), // 2: errdefs.FrontendCap - (*Subrequest)(nil), // 3: errdefs.Subrequest - (*Solve)(nil), // 4: errdefs.Solve - (*FileAction)(nil), // 5: errdefs.FileAction - (*ContentCache)(nil), // 6: errdefs.ContentCache - nil, // 7: errdefs.Solve.DescriptionEntry - (*pb.SourceInfo)(nil), // 8: pb.SourceInfo - (*pb.Range)(nil), // 9: pb.Range - (*pb.Op)(nil), // 10: pb.Op + (*Frontend)(nil), // 2: errdefs.Frontend + (*FrontendCap)(nil), // 3: errdefs.FrontendCap + (*Subrequest)(nil), // 4: errdefs.Subrequest + (*Solve)(nil), // 5: errdefs.Solve + (*FileAction)(nil), // 6: errdefs.FileAction + (*ContentCache)(nil), // 7: errdefs.ContentCache + nil, // 8: errdefs.Solve.DescriptionEntry + (*pb.SourceInfo)(nil), // 9: pb.SourceInfo + (*pb.Range)(nil), // 10: pb.Range + (*pb.Op)(nil), // 11: pb.Op } var file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_depIdxs = []int32{ - 8, // 0: errdefs.Source.info:type_name -> pb.SourceInfo - 9, // 1: errdefs.Source.ranges:type_name -> pb.Range - 10, // 2: errdefs.Solve.op:type_name -> pb.Op - 5, // 3: errdefs.Solve.file:type_name -> errdefs.FileAction - 6, // 4: errdefs.Solve.cache:type_name -> errdefs.ContentCache - 7, // 5: errdefs.Solve.description:type_name -> errdefs.Solve.DescriptionEntry + 9, // 0: errdefs.Source.info:type_name -> pb.SourceInfo + 10, // 1: errdefs.Source.ranges:type_name -> pb.Range + 11, // 2: errdefs.Solve.op:type_name -> pb.Op + 6, // 3: errdefs.Solve.file:type_name -> errdefs.FileAction + 7, // 4: errdefs.Solve.cache:type_name -> errdefs.ContentCache + 8, // 5: errdefs.Solve.description:type_name -> errdefs.Solve.DescriptionEntry 6, // [6:6] is the sub-list for method output_type 6, // [6:6] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name @@ -509,7 +566,7 @@ func file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_init() { if File_github_com_moby_buildkit_solver_errdefs_errdefs_proto != nil { return } - file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[4].OneofWrappers = []any{ + file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[5].OneofWrappers = []any{ (*Solve_File)(nil), (*Solve_Cache)(nil), } @@ -519,7 +576,7 @@ func file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/github.com/moby/buildkit/solver/errdefs/errdefs.proto b/vendor/github.com/moby/buildkit/solver/errdefs/errdefs.proto index 97489b930..df0dd8c95 100644 --- a/vendor/github.com/moby/buildkit/solver/errdefs/errdefs.proto +++ b/vendor/github.com/moby/buildkit/solver/errdefs/errdefs.proto @@ -15,6 +15,11 @@ message Source { repeated pb.Range ranges = 2; } +message Frontend { + string name = 1; // frontend name e.g. dockerfile.v0 or gateway.v0 + string source = 2; // used by the gateway frontend to identify the source, which corresponds to the image name +} + message FrontendCap { string name = 1; } diff --git a/vendor/github.com/moby/buildkit/solver/errdefs/errdefs_vtproto.pb.go b/vendor/github.com/moby/buildkit/solver/errdefs/errdefs_vtproto.pb.go index f94174ed3..597ca4a89 100644 --- a/vendor/github.com/moby/buildkit/solver/errdefs/errdefs_vtproto.pb.go +++ b/vendor/github.com/moby/buildkit/solver/errdefs/errdefs_vtproto.pb.go @@ -61,6 +61,24 @@ func (m *Source) CloneMessageVT() proto.Message { return m.CloneVT() } +func (m *Frontend) CloneVT() *Frontend { + if m == nil { + return (*Frontend)(nil) + } + r := new(Frontend) + r.Name = m.Name + r.Source = m.Source + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Frontend) CloneMessageVT() proto.Message { + return m.CloneVT() +} + func (m *FrontendCap) CloneVT() *FrontendCap { if m == nil { return (*FrontendCap)(nil) @@ -239,6 +257,28 @@ func (this *Source) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } +func (this *Frontend) EqualVT(that *Frontend) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Name != that.Name { + return false + } + if this.Source != that.Source { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Frontend) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Frontend) + if !ok { + return false + } + return this.EqualVT(that) +} func (this *FrontendCap) EqualVT(that *FrontendCap) bool { if this == that { return true @@ -519,6 +559,53 @@ func (m *Source) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Frontend) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Frontend) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Frontend) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Source) > 0 { + i -= len(m.Source) + copy(dAtA[i:], m.Source) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Source))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *FrontendCap) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -844,6 +931,24 @@ func (m *Source) SizeVT() (n int) { return n } +func (m *Frontend) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.Source) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + func (m *FrontendCap) SizeVT() (n int) { if m == nil { return 0 @@ -1167,6 +1272,121 @@ func (m *Source) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *Frontend) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Frontend: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Frontend: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Source = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *FrontendCap) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/vendor/github.com/moby/buildkit/solver/errdefs/frontend.go b/vendor/github.com/moby/buildkit/solver/errdefs/frontend.go new file mode 100644 index 000000000..70137878e --- /dev/null +++ b/vendor/github.com/moby/buildkit/solver/errdefs/frontend.go @@ -0,0 +1,50 @@ +package errdefs + +import ( + "errors" + "fmt" + + "github.com/containerd/typeurl/v2" + "github.com/moby/buildkit/util/grpcerrors" +) + +func init() { + typeurl.Register((*Frontend)(nil), "github.com/moby/buildkit", "errdefs.Frontend+json") +} + +type FrontendError struct { + *Frontend + error +} + +func (e *FrontendError) Error() string { + // These can be nested, so avoid adding any details to the error message + // if we already have an error. Otherwise the resulting error message + // can be very long and not very useful. + if e.error != nil { + return e.error.Error() + } + return fmt.Sprintf("frontend %s failed", e.Name) +} + +func (e *FrontendError) Unwrap() error { + return e.error +} + +func (e *FrontendError) ToProto() grpcerrors.TypedErrorProto { + return e.Frontend +} + +func (v *Frontend) WrapError(err error) error { + return &FrontendError{error: err, Frontend: v} +} + +func Frontends(err error) []*Frontend { + var out []*Frontend + var es *FrontendError + if errors.As(err, &es) { + out = Frontends(es.Unwrap()) + out = append(out, es.CloneVT()) + } + return out +} diff --git a/vendor/github.com/moby/buildkit/solver/errdefs/fronetendcap.go b/vendor/github.com/moby/buildkit/solver/errdefs/frontendcap.go similarity index 91% rename from vendor/github.com/moby/buildkit/solver/errdefs/fronetendcap.go rename to vendor/github.com/moby/buildkit/solver/errdefs/frontendcap.go index 72ee63682..d7acf0521 100644 --- a/vendor/github.com/moby/buildkit/solver/errdefs/fronetendcap.go +++ b/vendor/github.com/moby/buildkit/solver/errdefs/frontendcap.go @@ -17,7 +17,7 @@ type UnsupportedFrontendCapError struct { } func (e *UnsupportedFrontendCapError) Error() string { - msg := fmt.Sprintf("unsupported frontend capability %s", e.FrontendCap.Name) + msg := fmt.Sprintf("unsupported frontend capability %s", e.Name) if e.error != nil { msg += ": " + e.error.Error() } diff --git a/vendor/github.com/moby/buildkit/solver/errdefs/solve.go b/vendor/github.com/moby/buildkit/solver/errdefs/solve.go index 3b457550e..691983caf 100644 --- a/vendor/github.com/moby/buildkit/solver/errdefs/solve.go +++ b/vendor/github.com/moby/buildkit/solver/errdefs/solve.go @@ -14,7 +14,7 @@ func init() { typeurl.Register((*Solve)(nil), "github.com/moby/buildkit", "errdefs.Solve+json") } -//nolint:revive +//nolint:revive,staticcheck type IsSolve_Subject isSolve_Subject // SolveError will be returned when an error is encountered during a solve that diff --git a/vendor/github.com/moby/buildkit/solver/errdefs/source.go b/vendor/github.com/moby/buildkit/solver/errdefs/source.go index c599f667f..290ed06db 100644 --- a/vendor/github.com/moby/buildkit/solver/errdefs/source.go +++ b/vendor/github.com/moby/buildkit/solver/errdefs/source.go @@ -14,34 +14,34 @@ func WithSource(err error, src *Source) error { if err == nil { return nil } - return &ErrorSource{Source: src, error: err} + return &SourceError{Source: src, error: err} } -type ErrorSource struct { +type SourceError struct { *Source error } -func (e *ErrorSource) Unwrap() error { +func (e *SourceError) Unwrap() error { return e.error } -func (e *ErrorSource) ToProto() grpcerrors.TypedErrorProto { +func (e *SourceError) ToProto() grpcerrors.TypedErrorProto { return e.Source } func Sources(err error) []*Source { var out []*Source - var es *ErrorSource + var es *SourceError if errors.As(err, &es) { out = Sources(es.Unwrap()) - out = append(out, es.Source.CloneVT()) + out = append(out, es.CloneVT()) } return out } func (s *Source) WrapError(err error) error { - return &ErrorSource{error: err, Source: s} + return &SourceError{error: err, Source: s} } func (s *Source) Print(w io.Writer) error { @@ -69,10 +69,7 @@ func (s *Source) Print(w io.Writer) error { var p int prepadStart := start - for { - if p >= pad { - break - } + for p < pad { if start > 1 { start-- p++ diff --git a/vendor/github.com/moby/buildkit/solver/errdefs/subrequest.go b/vendor/github.com/moby/buildkit/solver/errdefs/subrequest.go index 0fba51d3c..254aebe77 100644 --- a/vendor/github.com/moby/buildkit/solver/errdefs/subrequest.go +++ b/vendor/github.com/moby/buildkit/solver/errdefs/subrequest.go @@ -17,7 +17,7 @@ type UnsupportedSubrequestError struct { } func (e *UnsupportedSubrequestError) Error() string { - msg := fmt.Sprintf("unsupported request %s", e.Subrequest.Name) + msg := fmt.Sprintf("unsupported request %s", e.Name) if e.error != nil { msg += ": " + e.error.Error() } diff --git a/vendor/github.com/moby/buildkit/solver/result/attestation.go b/vendor/github.com/moby/buildkit/solver/result/attestation.go index 2fee27824..de56e3c40 100644 --- a/vendor/github.com/moby/buildkit/solver/result/attestation.go +++ b/vendor/github.com/moby/buildkit/solver/result/attestation.go @@ -1,6 +1,8 @@ package result import ( + "context" + pb "github.com/moby/buildkit/frontend/gateway/pb" digest "github.com/opencontainers/go-digest" ) @@ -23,7 +25,7 @@ type Attestation[T any] struct { Ref T Path string - ContentFunc func() ([]byte, error) + ContentFunc func(context.Context) ([]byte, error) InToto InTotoAttestation } diff --git a/vendor/github.com/moby/buildkit/sourcepolicy/pb/json.go b/vendor/github.com/moby/buildkit/sourcepolicy/pb/json.go index 9ca101eb7..4b61d0a6d 100644 --- a/vendor/github.com/moby/buildkit/sourcepolicy/pb/json.go +++ b/vendor/github.com/moby/buildkit/sourcepolicy/pb/json.go @@ -1,4 +1,4 @@ -package moby_buildkit_v1_sourcepolicy //nolint:revive +package moby_buildkit_v1_sourcepolicy //nolint:revive,staticcheck import ( "github.com/moby/buildkit/util/gogo/proto" diff --git a/vendor/github.com/moby/buildkit/util/apicaps/caps.go b/vendor/github.com/moby/buildkit/util/apicaps/caps.go index f43a7545a..a49ed79bb 100644 --- a/vendor/github.com/moby/buildkit/util/apicaps/caps.go +++ b/vendor/github.com/moby/buildkit/util/apicaps/caps.go @@ -1,8 +1,9 @@ package apicaps import ( + "cmp" "fmt" - "sort" + "slices" "strings" pb "github.com/moby/buildkit/util/apicaps/pb" @@ -76,8 +77,8 @@ func (l *CapList) All() []*pb.APICap { DisabledAlternative: c.DisabledAlternative, }) } - sort.Slice(out, func(i, j int) bool { - return out[i].ID < out[j].ID + slices.SortFunc(out, func(a, b *pb.APICap) int { + return cmp.Compare(a.ID, b.ID) }) return out } diff --git a/vendor/github.com/moby/buildkit/util/appcontext/appcontext.go b/vendor/github.com/moby/buildkit/util/appcontext/appcontext.go index d5a785ef6..28626fd7a 100644 --- a/vendor/github.com/moby/buildkit/util/appcontext/appcontext.go +++ b/vendor/github.com/moby/buildkit/util/appcontext/appcontext.go @@ -25,11 +25,11 @@ func Context() context.Context { ctx := context.Background() for _, f := range inits { - ctx = f(ctx) + ctx = f(ctx) //nolint:fatcontext } ctx, cancel := context.WithCancelCause(ctx) - appContextCache = ctx + appContextCache = ctx //nolint:fatcontext go func() { for { diff --git a/vendor/github.com/moby/buildkit/util/appdefaults/appdefaults_windows.go b/vendor/github.com/moby/buildkit/util/appdefaults/appdefaults_windows.go index 6917469fe..3fb69f26d 100644 --- a/vendor/github.com/moby/buildkit/util/appdefaults/appdefaults_windows.go +++ b/vendor/github.com/moby/buildkit/util/appdefaults/appdefaults_windows.go @@ -12,8 +12,9 @@ const ( var ( Root = filepath.Join(os.Getenv("ProgramData"), "buildkitd", ".buildstate") ConfigDir = filepath.Join(os.Getenv("ProgramData"), "buildkitd") - DefaultCNIBinDir = filepath.Join(ConfigDir, "bin") - DefaultCNIConfigPath = filepath.Join(ConfigDir, "cni.json") + defaultContainerdDir = filepath.Join(os.Getenv("ProgramFiles"), "containerd") + DefaultCNIBinDir = filepath.Join(defaultContainerdDir, "cni", "bin") + DefaultCNIConfigPath = filepath.Join(defaultContainerdDir, "cni", "conf", "0-containerd-nat.conf") ) var ( diff --git a/vendor/github.com/moby/buildkit/util/contentutil/copy.go b/vendor/github.com/moby/buildkit/util/contentutil/copy.go index 505a08187..c1c10b5af 100644 --- a/vendor/github.com/moby/buildkit/util/contentutil/copy.go +++ b/vendor/github.com/moby/buildkit/util/contentutil/copy.go @@ -27,7 +27,7 @@ type localFetcher struct { } func (f *localFetcher) Fetch(ctx context.Context, desc ocispecs.Descriptor) (io.ReadCloser, error) { - r, err := f.Provider.ReaderAt(ctx, desc) + r, err := f.ReaderAt(ctx, desc) if err != nil { return nil, err } @@ -42,7 +42,7 @@ type rc struct { func (r *rc) Read(b []byte) (int, error) { n, err := r.ReadAt(b, r.offset) r.offset += int64(n) - if n > 0 && err == io.EOF { + if n > 0 && errors.Is(err, io.EOF) { err = nil } return n, err diff --git a/vendor/github.com/moby/buildkit/util/contentutil/fetcher.go b/vendor/github.com/moby/buildkit/util/contentutil/fetcher.go index f7105fd9e..560b9fcfc 100644 --- a/vendor/github.com/moby/buildkit/util/contentutil/fetcher.go +++ b/vendor/github.com/moby/buildkit/util/contentutil/fetcher.go @@ -54,8 +54,8 @@ func (r *readerAt) ReadAt(b []byte, off int64) (int, error) { var totalN int for len(b) > 0 { - n, err := r.Reader.Read(b) - if err == io.EOF && n == len(b) { + n, err := r.Read(b) + if errors.Is(err, io.EOF) && n == len(b) { err = nil } r.offset += int64(n) diff --git a/vendor/github.com/moby/buildkit/util/disk/disk_freebsd.go b/vendor/github.com/moby/buildkit/util/disk/disk_freebsd.go index 755a834c3..7d422240c 100644 --- a/vendor/github.com/moby/buildkit/util/disk/disk_freebsd.go +++ b/vendor/github.com/moby/buildkit/util/disk/disk_freebsd.go @@ -17,6 +17,6 @@ func GetDiskStat(root string) (DiskStat, error) { return DiskStat{ Total: int64(st.Bsize) * int64(st.Blocks), Free: int64(st.Bsize) * int64(st.Bfree), - Available: int64(st.Bsize) * int64(st.Bavail), + Available: int64(st.Bsize) * st.Bavail, }, nil } diff --git a/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go b/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go index 2ed11a95a..e986d6764 100644 --- a/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go +++ b/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go @@ -5,7 +5,6 @@ import ( "io" "math/rand" "slices" - "sort" "sync" "time" @@ -300,7 +299,7 @@ func (ps *progressState) run(pr progress.Reader) { for { p, err := pr.Read(context.TODO()) if err != nil { - if err == io.EOF { + if errors.Is(err, io.EOF) { ps.mu.Lock() ps.done = true ps.mu.Unlock() @@ -331,8 +330,8 @@ func (ps *progressState) add(pw progress.Writer) { for _, p := range ps.items { plist = append(plist, p) } - sort.Slice(plist, func(i, j int) bool { - return plist[i].Timestamp.Before(plist[j].Timestamp) + slices.SortFunc(plist, func(a, b *progress.Progress) int { + return a.Timestamp.Compare(b.Timestamp) }) for _, p := range plist { rw.WriteRawProgress(p) diff --git a/vendor/github.com/moby/buildkit/util/grpcerrors/grpcerrors.go b/vendor/github.com/moby/buildkit/util/grpcerrors/grpcerrors.go index ecb0dbe79..8689dfff0 100644 --- a/vendor/github.com/moby/buildkit/util/grpcerrors/grpcerrors.go +++ b/vendor/github.com/moby/buildkit/util/grpcerrors/grpcerrors.go @@ -45,7 +45,7 @@ func ToGRPC(ctx context.Context, err error) error { // If the original error was wrapped with more context than the GRPCStatus error, // copy the original message to the GRPCStatus error - if err.Error() != st.Message() { + if errorHasMoreContext(err, st) { pb := st.Proto() pb.Message = err.Error() st = status.FromProto(pb) @@ -72,6 +72,21 @@ func ToGRPC(ctx context.Context, err error) error { return st.Err() } +// errorHasMoreContext checks if the original error provides more context by having +// a different message or additional details than the Status. +func errorHasMoreContext(err error, st *status.Status) bool { + if errMessage := err.Error(); len(errMessage) > len(st.Message()) { + // check if the longer message in errMessage is only due to + // prepending with the status code + var grpcStatusError *grpcStatusError + if errors.As(err, &grpcStatusError) { + return st.Code() != grpcStatusError.st.Code() || st.Message() != grpcStatusError.st.Message() + } + return true + } + return false +} + func withDetails(ctx context.Context, s *status.Status, details ...proto.Message) (*status.Status, error) { if s.Code() == codes.OK { return nil, errors.New("no error details for status with code OK") @@ -124,7 +139,7 @@ func Code(err error) codes.Code { } func WrapCode(err error, code codes.Code) error { - return &withCode{error: err, code: code} + return &withCodeError{error: err, code: code} } func AsGRPCStatus(err error) (*status.Status, bool) { @@ -172,6 +187,8 @@ func FromGRPC(err error) error { for _, d := range pb.Details { m, err := typeurl.UnmarshalAny(d) if err != nil { + bklog.L.Debugf("failed to unmarshal error detail with type %q: %v", d.GetTypeUrl(), err) + n.Details = append(n.Details, d) continue } @@ -181,6 +198,7 @@ func FromGRPC(err error) error { case TypedErrorProto: details = append(details, v) default: + bklog.L.Debugf("unknown detail with type %T", v) n.Details = append(n.Details, d) } } @@ -219,16 +237,16 @@ func (e *grpcStatusError) GRPCStatus() *status.Status { return e.st } -type withCode struct { +type withCodeError struct { code codes.Code error } -func (e *withCode) Code() codes.Code { +func (e *withCodeError) Code() codes.Code { return e.code } -func (e *withCode) Unwrap() error { +func (e *withCodeError) Unwrap() error { return e.error } diff --git a/vendor/github.com/moby/buildkit/util/progress/multireader.go b/vendor/github.com/moby/buildkit/util/progress/multireader.go index 6afcca9fe..bcc9eb897 100644 --- a/vendor/github.com/moby/buildkit/util/progress/multireader.go +++ b/vendor/github.com/moby/buildkit/util/progress/multireader.go @@ -2,6 +2,7 @@ package progress import ( "context" + "errors" "io" "sync" ) @@ -110,7 +111,7 @@ func (mr *MultiReader) handle() error { for { p, err := mr.main.Read(context.TODO()) if err != nil { - if err == io.EOF { + if errors.Is(err, io.EOF) { mr.mu.Lock() cancelErr := context.Canceled for w, c := range mr.writers { diff --git a/vendor/github.com/moby/buildkit/util/progress/multiwriter.go b/vendor/github.com/moby/buildkit/util/progress/multiwriter.go index e6b53ec7f..acebbc175 100644 --- a/vendor/github.com/moby/buildkit/util/progress/multiwriter.go +++ b/vendor/github.com/moby/buildkit/util/progress/multiwriter.go @@ -2,7 +2,7 @@ package progress import ( "maps" - "sort" + "slices" "sync" "time" ) @@ -49,8 +49,8 @@ func (ps *MultiWriter) Add(pw Writer) { ps.mu.Lock() plist := make([]*Progress, 0, len(ps.items)) plist = append(plist, ps.items...) - sort.Slice(plist, func(i, j int) bool { - return plist[i].Timestamp.Before(plist[j].Timestamp) + slices.SortFunc(plist, func(a, b *Progress) int { + return a.Timestamp.Compare(b.Timestamp) }) for _, p := range plist { rw.WriteRawProgress(p) diff --git a/vendor/github.com/moby/buildkit/util/progress/progress.go b/vendor/github.com/moby/buildkit/util/progress/progress.go index f723bc931..e735c62c6 100644 --- a/vendor/github.com/moby/buildkit/util/progress/progress.go +++ b/vendor/github.com/moby/buildkit/util/progress/progress.go @@ -4,7 +4,7 @@ import ( "context" "io" "maps" - "sort" + "slices" "sync" "time" @@ -165,9 +165,8 @@ func (pr *progressReader) Read(ctx context.Context) ([]*Progress, error) { for _, p := range dmap { out = append(out, p) } - - sort.Slice(out, func(i, j int) bool { - return out[i].Timestamp.Before(out[j].Timestamp) + slices.SortFunc(out, func(a, b *Progress) int { + return a.Timestamp.Compare(b.Timestamp) }) return out, nil diff --git a/vendor/github.com/moby/buildkit/util/progress/progressui/colors.go b/vendor/github.com/moby/buildkit/util/progress/progressui/colors.go index e48535960..9dd7b3247 100644 --- a/vendor/github.com/moby/buildkit/util/progress/progressui/colors.go +++ b/vendor/github.com/moby/buildkit/util/progress/progressui/colors.go @@ -40,7 +40,7 @@ func setUserDefinedTermColors(colorsEnv string) { for _, field := range fields { k, v, ok := strings.Cut(field, "=") if !ok || strings.Contains(v, "=") { - err := errors.New("A valid entry must have exactly two fields") + err := errors.New("valid entry must have exactly two fields") bklog.L.WithError(err).Warnf("Could not parse BUILDKIT_COLORS component: %s", field) continue } @@ -52,7 +52,7 @@ func setUserDefinedTermColors(colorsEnv string) { parseKeys(k, c) } } else { - err := errors.New("Colors must be a name from the pre-defined list or a valid 3-part RGB value") + err := errors.New("colors must be a name from the pre-defined list or a valid 3-part RGB value") bklog.L.WithError(err).Warnf("Unknown color value found in BUILDKIT_COLORS: %s=%s", k, v) } } @@ -63,7 +63,7 @@ func readBuildkitColorsEnv(colorsEnv string) []string { csvReader.Comma = ':' fields, err := csvReader.Fields(colorsEnv, nil) if err != nil { - bklog.L.WithError(err).Warnf("Could not parse BUILDKIT_COLORS. Falling back to defaults.") + bklog.L.WithError(err).Warnf("could not parse BUILDKIT_COLORS. Falling back to defaults.") return nil } return fields @@ -76,7 +76,7 @@ func readRGB(v string) aec.ANSI { return nil } if len(fields) != 3 { - err = errors.New("A valid RGB color must have three fields") + err = errors.New("valid RGB color must have three fields") bklog.L.WithError(err).Warnf("Could not parse value %s as valid RGB color. Ignoring.", v) return nil } diff --git a/vendor/github.com/moby/buildkit/util/progress/progressui/display.go b/vendor/github.com/moby/buildkit/util/progress/progressui/display.go index 89cf57f98..41d108586 100644 --- a/vendor/github.com/moby/buildkit/util/progress/progressui/display.go +++ b/vendor/github.com/moby/buildkit/util/progress/progressui/display.go @@ -8,6 +8,7 @@ import ( "fmt" "io" "os" + "slices" "sort" "strconv" "strings" @@ -518,8 +519,8 @@ func mergeIntervals(intervals []interval) []interval { } // sort intervals by start time - sort.Slice(intervals, func(i, j int) bool { - return intervals[i].start.Before(*intervals[j].start) + slices.SortFunc(intervals, func(a, b interval) int { + return a.start.Compare(*b.start) }) var merged []interval @@ -587,10 +588,8 @@ func (t *trace) triggerVertexEvent(v *client.Vertex) { old = *v } - changed := false - if v.Digest != old.Digest { - changed = true - } + changed := v.Digest != old.Digest + if v.Name != old.Name { changed = true } @@ -641,7 +640,11 @@ func (t *trace) update(s *client.SolveStatus, termWidth int) { subVtxs: make(map[digest.Digest]client.Vertex), } if t.modeConsole { - group.term = vt100.NewVT100(termHeight, termWidth-termPad) + w := termWidth - termPad + if w <= 0 { + w = 1 + } + group.term = vt100.NewVT100(termHeight, w) } t.groups[v.ProgressGroup.Id] = group t.byDigest[group.Digest] = group.vertex @@ -662,7 +665,11 @@ func (t *trace) update(s *client.SolveStatus, termWidth int) { intervals: make(map[int64]interval), } if t.modeConsole { - t.byDigest[v.Digest].term = vt100.NewVT100(termHeight, termWidth-termPad) + w := termWidth - termPad + if w <= 0 { + w = 1 + } + t.byDigest[v.Digest].term = vt100.NewVT100(termHeight, w) } } t.triggerVertexEvent(v) @@ -673,7 +680,7 @@ func (t *trace) update(s *client.SolveStatus, termWidth int) { t.vertexes = append(t.vertexes, t.byDigest[v.Digest]) } // allow a duplicate initial vertex that shouldn't reset state - if !(prev != nil && prev.isStarted() && v.Started == nil) { + if prev == nil || !prev.isStarted() || v.Started != nil { t.byDigest[v.Digest].Vertex = v } if v.Started != nil { @@ -1000,6 +1007,9 @@ func (disp *ttyDisplay) print(d displayInfo, width, height int, all bool) { } else { out = align(out, "", width) } + if len(out) > width { + out = out[:width] + } fmt.Fprintln(disp.c, out) lineCount := 0 for _, j := range d.jobs { diff --git a/vendor/github.com/moby/buildkit/util/progress/progressui/printer.go b/vendor/github.com/moby/buildkit/util/progress/progressui/printer.go index 338079d47..61443ca33 100644 --- a/vendor/github.com/moby/buildkit/util/progress/progressui/printer.go +++ b/vendor/github.com/moby/buildkit/util/progress/progressui/printer.go @@ -147,7 +147,7 @@ func (p *textMux) printVtx(t *trace, dgst digest.Digest) { l = l[v.logsOffset:] fmt.Fprintf(p.w, "%s", l) } else { - fmt.Fprintf(p.w, "#%d %s", v.index, []byte(l)) + fmt.Fprintf(p.w, "#%d %s", v.index, l) } if i != len(v.logs)-1 || !v.logsPartial { diff --git a/vendor/github.com/moby/buildkit/util/stack/compress.go b/vendor/github.com/moby/buildkit/util/stack/compress.go index 6d9a78f34..e09ea1518 100644 --- a/vendor/github.com/moby/buildkit/util/stack/compress.go +++ b/vendor/github.com/moby/buildkit/util/stack/compress.go @@ -25,7 +25,7 @@ loop0: } // full match, potentially skip all if idx == len(st.Frames)-1 { - if st.Pid == prev.Pid && st.Version == prev.Version && slices.Compare(st.Cmdline, st.Cmdline) == 0 { + if st.Pid == prev.Pid && st.Version == prev.Version && slices.Equal(st.Cmdline, prev.Cmdline) { continue loop0 } } diff --git a/vendor/github.com/moby/buildkit/util/stack/stack.go b/vendor/github.com/moby/buildkit/util/stack/stack.go index 458a1a781..d9bacd410 100644 --- a/vendor/github.com/moby/buildkit/util/stack/stack.go +++ b/vendor/github.com/moby/buildkit/util/stack/stack.go @@ -50,7 +50,7 @@ func Traces(err error) []*Stack { func traces(err error) []*Stack { var st []*Stack - switch e := err.(type) { + switch e := err.(type) { //nolint:errorlint case interface{ Unwrap() error }: st = Traces(e.Unwrap()) case interface{ Unwrap() []error }: @@ -63,7 +63,7 @@ func traces(err error) []*Stack { } } - switch ste := err.(type) { + switch ste := err.(type) { //nolint:errorlint case interface{ StackTrace() errors.StackTrace }: st = append(st, convertStack(ste.StackTrace())) case interface{ StackTrace() *Stack }: @@ -85,7 +85,7 @@ func Enable(err error) error { } func Wrap(err error, s *Stack) error { - return &withStack{stack: s, error: err} + return &withStackError{stack: s, error: err} } func hasLocalStackTrace(err error) bool { @@ -173,15 +173,15 @@ func convertStack(s errors.StackTrace) *Stack { return &out } -type withStack struct { +type withStackError struct { stack *Stack error } -func (e *withStack) Unwrap() error { +func (e *withStackError) Unwrap() error { return e.error } -func (e *withStack) StackTrace() *Stack { +func (e *withStackError) StackTrace() *Stack { return e.stack } diff --git a/vendor/github.com/moby/buildkit/util/testutil/dockerd/client/request.go b/vendor/github.com/moby/buildkit/util/testutil/dockerd/client/request.go index 47dc9ec06..1b81704a6 100644 --- a/vendor/github.com/moby/buildkit/util/testutil/dockerd/client/request.go +++ b/vendor/github.com/moby/buildkit/util/testutil/dockerd/client/request.go @@ -52,15 +52,18 @@ func (cli *Client) doRequest(req *http.Request) (*http.Response, error) { return nil, err } - if uErr, ok := err.(*url.Error); ok { - if nErr, ok := uErr.Err.(*net.OpError); ok { + uErr := &url.Error{} + if errors.As(err, &uErr) { + nErr := &net.OpError{} + if errors.As(uErr.Err, &nErr) { if os.IsPermission(nErr.Err) { return nil, errors.Wrapf(err, "permission denied while trying to connect to the Docker daemon socket at %v", cli.host) } } } - if nErr, ok := err.(net.Error); ok { + var nErr net.Error + if errors.As(err, &nErr) { // FIXME(thaJeztah): any net.Error should be considered a connection error (but we should include the original error)? if nErr.Timeout() { return nil, ErrorConnectionFailed(cli.host) diff --git a/vendor/github.com/moby/buildkit/util/testutil/dockerd/daemon.go b/vendor/github.com/moby/buildkit/util/testutil/dockerd/daemon.go index c2523adf3..fd7cd21ce 100644 --- a/vendor/github.com/moby/buildkit/util/testutil/dockerd/daemon.go +++ b/vendor/github.com/moby/buildkit/util/testutil/dockerd/daemon.go @@ -72,7 +72,7 @@ func NewDaemon(workingDir string, ops ...Option) (*Daemon, error) { execRoot: filepath.Join(os.TempDir(), "dxr", id), dockerdBinary: DefaultDockerdBinary, Log: nopLog{}, - sockPath: filepath.Join(sockRoot, id+".sock"), + sockPath: getDockerdSockPath(sockRoot, id), envs: os.Environ(), } @@ -96,7 +96,7 @@ func WithExtraEnv(envs []string) Option { } func (d *Daemon) Sock() string { - return "unix://" + d.sockPath + return socketScheme + d.sockPath } func (d *Daemon) StartWithError(daemonLogs map[string]*bytes.Buffer, providedArgs ...string) error { diff --git a/vendor/github.com/moby/buildkit/util/testutil/dockerd/daemon_unix.go b/vendor/github.com/moby/buildkit/util/testutil/dockerd/daemon_unix.go new file mode 100644 index 000000000..ad1514ebc --- /dev/null +++ b/vendor/github.com/moby/buildkit/util/testutil/dockerd/daemon_unix.go @@ -0,0 +1,11 @@ +//go:build !windows + +package dockerd + +import "path/filepath" + +const socketScheme = "unix://" + +func getDockerdSockPath(sockRoot, id string) string { + return filepath.Join(sockRoot, id+".sock") +} diff --git a/vendor/github.com/moby/buildkit/util/testutil/dockerd/daemon_windows.go b/vendor/github.com/moby/buildkit/util/testutil/dockerd/daemon_windows.go new file mode 100644 index 000000000..c281b742a --- /dev/null +++ b/vendor/github.com/moby/buildkit/util/testutil/dockerd/daemon_windows.go @@ -0,0 +1,7 @@ +package dockerd + +const socketScheme = "npipe://" + +func getDockerdSockPath(_, id string) string { + return `//./pipe/dockerd-` + id +} diff --git a/vendor/github.com/moby/buildkit/util/testutil/integration/registry.go b/vendor/github.com/moby/buildkit/util/testutil/integration/registry.go index 0f2152de5..ccb9a1fd6 100644 --- a/vendor/github.com/moby/buildkit/util/testutil/integration/registry.go +++ b/vendor/github.com/moby/buildkit/util/testutil/integration/registry.go @@ -68,7 +68,7 @@ http: deferF.Append(stop) ctx, cancel := context.WithCancelCause(context.Background()) - ctx, _ = context.WithTimeoutCause(ctx, 5*time.Second, errors.WithStack(context.DeadlineExceeded)) + ctx, _ = context.WithTimeoutCause(ctx, 5*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet defer func() { cancel(errors.WithStack(context.Canceled)) }() url, err = detectPort(ctx, rc) if err != nil { diff --git a/vendor/github.com/moby/buildkit/util/testutil/integration/run.go b/vendor/github.com/moby/buildkit/util/testutil/integration/run.go index fefbb167c..754527a97 100644 --- a/vendor/github.com/moby/buildkit/util/testutil/integration/run.go +++ b/vendor/github.com/moby/buildkit/util/testutil/integration/run.go @@ -12,7 +12,7 @@ import ( "path/filepath" "reflect" "runtime" - "sort" + "slices" "strconv" "strings" "sync" @@ -168,8 +168,8 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) { parts := strings.Split(filter, "/") if len(parts) >= 2 { const prefix = "slice=" - if strings.HasPrefix(parts[1], prefix) { - conf := strings.TrimPrefix(parts[1], prefix) + if after, ok0 := strings.CutPrefix(parts[1], prefix); ok0 { + conf := after offsetS, totalS, ok := strings.Cut(conf, "-") if !ok { t.Fatalf("invalid slice=%q", conf) @@ -462,7 +462,7 @@ func (mv matrixValue) functionSuffix() string { if len(mv.fn) == 0 { return "" } - sort.Strings(mv.fn) + slices.Sort(mv.fn) sb := &strings.Builder{} for _, f := range mv.fn { sb.Write([]byte("/" + f + "=" + mv.values[f].name)) @@ -514,8 +514,8 @@ func prepareValueMatrix(tc testConf) []matrixValue { func SkipOnPlatform(t *testing.T, goos string) { skip := false // support for negation - if strings.HasPrefix(goos, "!") { - goos = strings.TrimPrefix(goos, "!") + if after, ok := strings.CutPrefix(goos, "!"); ok { + goos = after skip = runtime.GOOS != goos } else { skip = runtime.GOOS == goos @@ -539,8 +539,8 @@ func UnixOrWindows[T any](unix, windows T) T { func lookupTestFilter() (string, bool) { const prefix = "-test.run=" for _, arg := range os.Args { - if strings.HasPrefix(arg, prefix) { - return strings.TrimPrefix(arg, prefix), true + if after, ok := strings.CutPrefix(arg, prefix); ok { + return after, true } } return "", false diff --git a/vendor/github.com/moby/buildkit/util/testutil/tar.go b/vendor/github.com/moby/buildkit/util/testutil/tar.go index a519026b6..94069e2bf 100644 --- a/vendor/github.com/moby/buildkit/util/testutil/tar.go +++ b/vendor/github.com/moby/buildkit/util/testutil/tar.go @@ -29,7 +29,7 @@ func ReadTarToMap(dt []byte, compressed bool) (map[string]*TarItem, error) { for { h, err := tr.Next() if err != nil { - if err == io.EOF { + if errors.Is(err, io.EOF) { return m, nil } return nil, errors.Wrap(err, "error reading tar") diff --git a/vendor/github.com/moby/buildkit/util/testutil/workers/dockerd.go b/vendor/github.com/moby/buildkit/util/testutil/workers/dockerd.go index ba557580e..2e84d4056 100644 --- a/vendor/github.com/moby/buildkit/util/testutil/workers/dockerd.go +++ b/vendor/github.com/moby/buildkit/util/testutil/workers/dockerd.go @@ -111,6 +111,7 @@ func (c Moby) New(ctx context.Context, cfg *integration.BackendConfig) (b integr "containerd-snapshotter": c.ContainerdSnapshotter, }, } + if reg, ok := bkcfg.Registries["docker.io"]; ok && len(reg.Mirrors) > 0 { for _, m := range reg.Mirrors { dcfg.Mirrors = append(dcfg.Mirrors, "http://"+m) @@ -158,10 +159,13 @@ func (c Moby) New(ctx context.Context, cfg *integration.BackendConfig) (b integr dockerdFlags := []string{ "--config-file", dockerdConfigFile, - "--userland-proxy=false", "--tls=false", "--debug", } + + // add platform-specific flags + dockerdFlags = applyDockerdPlatformFlags(dockerdFlags, c.ID) + if s := os.Getenv("BUILDKIT_INTEGRATION_DOCKERD_FLAGS"); s != "" { dockerdFlags = append(dockerdFlags, strings.Split(strings.TrimSpace(s), "\n")...) } @@ -198,7 +202,7 @@ func (c Moby) New(ctx context.Context, cfg *integration.BackendConfig) (b integr f.Close() os.Remove(localPath) - listener, err := net.Listen("unix", localPath) + listener, err := net.Listen(buildkitdNetworkProtocol, getBuildkitdNetworkAddr(localPath)) if err != nil { return nil, nil, errors.Wrapf(err, "dockerd listener error: %s", integration.FormatLogs(cfg.Logs)) } @@ -234,7 +238,7 @@ func (c Moby) New(ctx context.Context, cfg *integration.BackendConfig) (b integr }) return backend{ - address: "unix://" + listener.Addr().String(), + address: buildkitdNetworkProtocol + "://" + listener.Addr().String(), dockerAddress: d.Sock(), rootless: c.IsRootless, netnsDetached: false, diff --git a/vendor/github.com/moby/buildkit/util/testutil/workers/util_unix.go b/vendor/github.com/moby/buildkit/util/testutil/workers/util_unix.go index 0b7d2d1be..12b2009f4 100644 --- a/vendor/github.com/moby/buildkit/util/testutil/workers/util_unix.go +++ b/vendor/github.com/moby/buildkit/util/testutil/workers/util_unix.go @@ -13,6 +13,8 @@ import ( "github.com/pkg/errors" ) +const buildkitdNetworkProtocol = "unix" + func applyBuildkitdPlatformFlags(args []string) []string { return append(args, "--oci-worker=false") } @@ -75,3 +77,12 @@ func normalizeAddress(address string) string { // for parity with windows, no effect for unix return address } + +func applyDockerdPlatformFlags(flags []string, _ string) []string { + flags = append(flags, "--userland-proxy=false") + return flags +} + +func getBuildkitdNetworkAddr(tmpdir string) string { + return tmpdir +} diff --git a/vendor/github.com/moby/buildkit/util/testutil/workers/util_windows.go b/vendor/github.com/moby/buildkit/util/testutil/workers/util_windows.go index 336df47ab..f6ccbf486 100644 --- a/vendor/github.com/moby/buildkit/util/testutil/workers/util_windows.go +++ b/vendor/github.com/moby/buildkit/util/testutil/workers/util_windows.go @@ -4,8 +4,12 @@ import ( "path/filepath" "strings" "syscall" + + "github.com/containerd/containerd/v2/defaults" ) +const buildkitdNetworkProtocol = "tcp" + func applyBuildkitdPlatformFlags(args []string) []string { return args } @@ -55,3 +59,15 @@ func normalizeAddress(address string) string { } return address } + +func applyDockerdPlatformFlags(flags []string, workerID string) []string { + if workerID == "dockerd-containerd" { + flags = append(flags, "--default-runtime="+defaults.DefaultRuntime) + } + return flags +} + +func getBuildkitdNetworkAddr(_ string) string { + // Using TCP on Windows, instead of Unix sockets. + return "localhost:0" +} diff --git a/vendor/github.com/moby/buildkit/util/tracing/detect/detect.go b/vendor/github.com/moby/buildkit/util/tracing/detect/detect.go index b32cc71f6..7dece5b2f 100644 --- a/vendor/github.com/moby/buildkit/util/tracing/detect/detect.go +++ b/vendor/github.com/moby/buildkit/util/tracing/detect/detect.go @@ -3,7 +3,7 @@ package detect import ( "context" "os" - "sort" + "slices" "strconv" "github.com/pkg/errors" @@ -66,8 +66,8 @@ func detectExporter[T any](envVar string, fn func(d ExporterDetector) (T, bool, for _, d := range detectors { arr = append(arr, d) } - sort.Slice(arr, func(i, j int) bool { - return arr[i].priority < arr[j].priority + slices.SortFunc(arr, func(a, b detector) int { + return a.priority - b.priority }) var ok bool diff --git a/vendor/github.com/moby/buildkit/util/tracing/otlptracegrpc/client.go b/vendor/github.com/moby/buildkit/util/tracing/otlptracegrpc/client.go index 5e15772d5..843e82613 100644 --- a/vendor/github.com/moby/buildkit/util/tracing/otlptracegrpc/client.go +++ b/vendor/github.com/moby/buildkit/util/tracing/otlptracegrpc/client.go @@ -72,7 +72,7 @@ func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc ctx, cancel := c.connection.ContextWithStop(ctx) defer func() { cancel(errors.WithStack(context.Canceled)) }() ctx, tCancel := context.WithCancelCause(ctx) - ctx, _ = context.WithTimeoutCause(ctx, 30*time.Second, errors.WithStack(context.DeadlineExceeded)) + ctx, _ = context.WithTimeoutCause(ctx, 30*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet defer tCancel(errors.WithStack(context.Canceled)) ctx = c.connection.ContextWithMetadata(ctx) diff --git a/vendor/github.com/moby/buildkit/util/tracing/tracing.go b/vendor/github.com/moby/buildkit/util/tracing/tracing.go index 038a7a17a..0d4fed97f 100644 --- a/vendor/github.com/moby/buildkit/util/tracing/tracing.go +++ b/vendor/github.com/moby/buildkit/util/tracing/tracing.go @@ -5,7 +5,6 @@ import ( "fmt" "net/http" "net/http/httptrace" - "slices" "github.com/moby/buildkit/util/bklog" "github.com/moby/buildkit/util/stack" @@ -34,19 +33,9 @@ func StartSpan(ctx context.Context, operationName string, opts ...trace.SpanStar } func hasStacktrace(err error) bool { - switch e := err.(type) { - case interface{ StackTrace() *stack.Stack }: - return true - case interface{ StackTrace() errors.StackTrace }: - return true - case interface{ Unwrap() error }: - return hasStacktrace(e.Unwrap()) - case interface{ Unwrap() []error }: - if slices.ContainsFunc(e.Unwrap(), hasStacktrace) { - return true - } - } - return false + var stack interface{ StackTrace() *stack.Stack } + var pkgStack interface{ StackTrace() errors.StackTrace } + return errors.As(err, &stack) || errors.As(err, &pkgStack) } // FinishWithError finalizes the span and sets the error if one is passed diff --git a/vendor/github.com/tonistiigi/fsutil/stat_unix.go b/vendor/github.com/tonistiigi/fsutil/stat_unix.go index def901e31..94e5da0f9 100644 --- a/vendor/github.com/tonistiigi/fsutil/stat_unix.go +++ b/vendor/github.com/tonistiigi/fsutil/stat_unix.go @@ -5,6 +5,7 @@ package fsutil import ( "os" + "strings" "syscall" "github.com/containerd/continuity/sysx" @@ -12,6 +13,8 @@ import ( "github.com/tonistiigi/fsutil/types" ) +const xattrApplePrefix = "com.apple." + func loadXattr(origpath string, stat *types.Stat) error { xattrs, err := sysx.LListxattr(origpath) if err != nil { @@ -23,16 +26,29 @@ func loadXattr(origpath string, stat *types.Stat) error { if len(xattrs) > 0 { m := make(map[string][]byte) for _, key := range xattrs { - v, err := sysx.LGetxattr(origpath, key) - if err == nil { + if skipXattr(key) { + continue + } + + if v, err := sysx.LGetxattr(origpath, key); err == nil { m[key] = v } } - stat.Xattrs = m + + if len(m) > 0 { + stat.Xattrs = m + } } return nil } +func skipXattr(key string) bool { + if strings.HasPrefix(key, xattrApplePrefix) { + return true + } + return false +} + func setUnixOpt(fi os.FileInfo, stat *types.Stat, path string, seenFiles map[uint64]string) { s := fi.Sys().(*syscall.Stat_t) diff --git a/vendor/modules.txt b/vendor/modules.txt index 93d299782..eada46783 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -451,7 +451,7 @@ github.com/mitchellh/go-wordwrap # github.com/mitchellh/hashstructure/v2 v2.0.2 ## explicit; go 1.14 github.com/mitchellh/hashstructure/v2 -# github.com/moby/buildkit v0.21.0 +# github.com/moby/buildkit v0.22.0-rc1 ## explicit; go 1.23.0 github.com/moby/buildkit/api/services/control github.com/moby/buildkit/api/types @@ -663,7 +663,7 @@ github.com/stretchr/testify/require # github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323 ## explicit; go 1.21 github.com/tonistiigi/dchapes-mode -# github.com/tonistiigi/fsutil v0.0.0-20250410151801-5b74a7ad7583 +# github.com/tonistiigi/fsutil v0.0.0-20250417144416-3f76f8130144 ## explicit; go 1.21 github.com/tonistiigi/fsutil github.com/tonistiigi/fsutil/copy