diff --git a/vendor.mod b/vendor.mod index 7b22925efc296..a7a9dfacb2870 100644 --- a/vendor.mod +++ b/vendor.mod @@ -62,7 +62,7 @@ require ( github.com/miekg/dns v1.1.57 github.com/mistifyio/go-zfs/v3 v3.0.1 github.com/mitchellh/copystructure v1.2.0 - github.com/moby/buildkit v0.15.0-rc1 + github.com/moby/buildkit v0.15.0-rc2 github.com/moby/docker-image-spec v1.3.1 github.com/moby/ipvs v1.1.0 github.com/moby/locker v1.0.1 @@ -198,7 +198,7 @@ require ( github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect github.com/tinylib/msgp v1.1.8 // indirect github.com/tonistiigi/go-actions-cache v0.0.0-20240327122527-58651d5e11d6 // indirect - github.com/tonistiigi/go-csvvalue v0.0.0-20240619222358-bb8dd5cba3c2 // indirect + github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 // indirect github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab // indirect github.com/weppos/publicsuffix-go v0.15.1-0.20210511084619-b1f36a2d6c0b // indirect diff --git a/vendor.sum b/vendor.sum index 610ddfb95fbf8..bbed3d2948319 100644 --- a/vendor.sum +++ b/vendor.sum @@ -481,8 +481,8 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b/go.mod h1:pzzDgJWZ34fGzaAZGFW22KVZDfyrYW+QABMrWnJBnSs= -github.com/moby/buildkit v0.15.0-rc1 h1:74cW+CaRhCX8b/0sTEwWM6zPxgHJb90imPZMf+E42TY= -github.com/moby/buildkit v0.15.0-rc1/go.mod h1:ik25J3PkZrQc2dDquClV6jXMjjtoXDCLFySlfZDk5j0= +github.com/moby/buildkit v0.15.0-rc2 h1:aHYfPGXcV4CiR4qZWZNVP/Khdgf7ftfSHZg4bhDkWjY= +github.com/moby/buildkit v0.15.0-rc2/go.mod h1:oN9S+8I7wF26vrqn9NuAF6dFSyGTfXvtiu9o1NlnnH4= 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/ipvs v1.1.0 h1:ONN4pGaZQgAx+1Scz5RvWV4Q7Gb+mvfRh3NsPS+1XQQ= @@ -676,8 +676,8 @@ github.com/tonistiigi/go-actions-cache v0.0.0-20240327122527-58651d5e11d6 h1:XFG github.com/tonistiigi/go-actions-cache v0.0.0-20240327122527-58651d5e11d6/go.mod h1:anhKd3mnC1shAbQj1Q4IJ+w6xqezxnyDYlx/yKa7IXM= github.com/tonistiigi/go-archvariant v1.0.0 h1:5LC1eDWiBNflnTF1prCiX09yfNHIxDC/aukdhCdTyb0= github.com/tonistiigi/go-archvariant v1.0.0/go.mod h1:TxFmO5VS6vMq2kvs3ht04iPXtu2rUT/erOnGFYfk5Ho= -github.com/tonistiigi/go-csvvalue v0.0.0-20240619222358-bb8dd5cba3c2 h1:4dXTcm/McJMoXXFhqr+4rNL4WkLqMoHkdMhT4nU0Z28= -github.com/tonistiigi/go-csvvalue v0.0.0-20240619222358-bb8dd5cba3c2/go.mod h1:278M4p8WsNh3n4a1eqiFcV2FGk7wE5fwUpUom9mK9lE= +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/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/v/cCndK0AMpt1wiVFb/YYmqB3/QG0= 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= diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go index 84716ec3ee91a..e88ae7b362183 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go @@ -40,6 +40,7 @@ import ( "github.com/moby/buildkit/util/suggest" "github.com/moby/buildkit/util/system" dockerspec "github.com/moby/docker-image-spec/specs-go/v1" + "github.com/moby/patternmatcher" "github.com/moby/sys/signal" digest "github.com/opencontainers/go-digest" ocispecs "github.com/opencontainers/image-spec/specs-go/v1" @@ -258,6 +259,9 @@ func toDispatchState(ctx context.Context, dt []byte, opt ConvertOpt) (*dispatchS if err != nil { return nil, err } + if len(stages) == 0 { + return nil, errors.New("dockerfile contains no stages to build") + } validateStageNames(stages, lint) shlex := shell.NewLex(dockerfile.EscapeToken) @@ -315,6 +319,7 @@ func toDispatchState(ctx context.Context, dt []byte, opt ConvertOpt) (*dispatchS platMatch, err := shlex.ProcessWordWithMatches(v, platEnv) reportUnusedFromArgs(metaArgsKeys(optMetaArgs), platMatch.Unmatched, st.Location, lint) reportRedundantTargetPlatform(st.Platform, platMatch, st.Location, platEnv, lint) + reportConstPlatformDisallowed(st.Name, platMatch, st.Location, lint) if err != nil { return nil, parser.WithLocation(errors.Wrapf(err, "failed to process arguments for platform %s", platMatch.Result), st.Location) @@ -590,6 +595,20 @@ func toDispatchState(ctx context.Context, dt []byte, opt ConvertOpt) (*dispatchS buildContext := &mutableOutput{} ctxPaths := map[string]struct{}{} + var dockerIgnoreMatcher *patternmatcher.PatternMatcher + if opt.Client != nil && opt.Client.CopyIgnoredCheckEnabled { + dockerIgnorePatterns, err := opt.Client.DockerIgnorePatterns(ctx) + if err != nil { + return nil, err + } + if len(dockerIgnorePatterns) > 0 { + dockerIgnoreMatcher, err = patternmatcher.New(dockerIgnorePatterns) + if err != nil { + return nil, err + } + } + } + for _, d := range allDispatchStates.states { if !opt.AllStages { if _, ok := allReachable[d]; !ok || d.noinit { @@ -630,24 +649,27 @@ func toDispatchState(ctx context.Context, dt []byte, opt ConvertOpt) (*dispatchS return nil, parser.WithLocation(err, d.stage.Location) } } + d.state = d.state.Network(opt.NetworkMode) + opt := dispatchOpt{ - allDispatchStates: allDispatchStates, - metaArgs: optMetaArgs, - buildArgValues: opt.BuildArgs, - shlex: shlex, - buildContext: llb.NewState(buildContext), - proxyEnv: proxyEnv, - cacheIDNamespace: opt.CacheIDNamespace, - buildPlatforms: platformOpt.buildPlatforms, - targetPlatform: platformOpt.targetPlatform, - extraHosts: opt.ExtraHosts, - shmSize: opt.ShmSize, - ulimit: opt.Ulimits, - cgroupParent: opt.CgroupParent, - llbCaps: opt.LLBCaps, - sourceMap: opt.SourceMap, - lint: lint, + allDispatchStates: allDispatchStates, + metaArgs: optMetaArgs, + buildArgValues: opt.BuildArgs, + shlex: shlex, + buildContext: llb.NewState(buildContext), + proxyEnv: proxyEnv, + cacheIDNamespace: opt.CacheIDNamespace, + buildPlatforms: platformOpt.buildPlatforms, + targetPlatform: platformOpt.targetPlatform, + extraHosts: opt.ExtraHosts, + shmSize: opt.ShmSize, + ulimit: opt.Ulimits, + cgroupParent: opt.CgroupParent, + llbCaps: opt.LLBCaps, + sourceMap: opt.SourceMap, + lint: lint, + dockerIgnoreMatcher: dockerIgnoreMatcher, } if err = dispatchOnBuildTriggers(d, d.image.Config.OnBuild, opt); err != nil { @@ -806,22 +828,23 @@ func toCommand(ic instructions.Command, allDispatchStates *dispatchStates) (comm } type dispatchOpt struct { - allDispatchStates *dispatchStates - metaArgs []instructions.KeyValuePairOptional - buildArgValues map[string]string - shlex *shell.Lex - buildContext llb.State - proxyEnv *llb.ProxyEnv - cacheIDNamespace string - targetPlatform ocispecs.Platform - buildPlatforms []ocispecs.Platform - extraHosts []llb.HostIP - shmSize int64 - ulimit []pb.Ulimit - cgroupParent string - llbCaps *apicaps.CapSet - sourceMap *llb.SourceMap - lint *linter.Linter + allDispatchStates *dispatchStates + metaArgs []instructions.KeyValuePairOptional + buildArgValues map[string]string + shlex *shell.Lex + buildContext llb.State + proxyEnv *llb.ProxyEnv + cacheIDNamespace string + targetPlatform ocispecs.Platform + buildPlatforms []ocispecs.Platform + extraHosts []llb.HostIP + shmSize int64 + ulimit []pb.Ulimit + cgroupParent string + llbCaps *apicaps.CapSet + sourceMap *llb.SourceMap + lint *linter.Linter + dockerIgnoreMatcher *patternmatcher.PatternMatcher } func getEnv(state llb.State) shell.EnvGetter { @@ -908,6 +931,7 @@ func dispatch(d *dispatchState, cmd command, opt dispatchOpt) error { keepGitDir: c.KeepGitDir, checksum: checksum, location: c.Location(), + ignoreMatcher: opt.dockerIgnoreMatcher, opt: opt, }) } @@ -942,12 +966,15 @@ func dispatch(d *dispatchState, cmd command, opt dispatchOpt) error { err = dispatchArg(d, c, &opt) case *instructions.CopyCommand: l := opt.buildContext + var ignoreMatcher *patternmatcher.PatternMatcher if len(cmd.sources) != 0 { src := cmd.sources[0] if !src.noinit { return errors.Errorf("cannot copy from stage %q, it needs to be defined before current stage %q", c.From, d.stageName) } l = src.state + } else { + ignoreMatcher = opt.dockerIgnoreMatcher } err = dispatchCopy(d, copyConfig{ params: c.SourcesAndDest, @@ -960,6 +987,7 @@ func dispatch(d *dispatchState, cmd command, opt dispatchOpt) error { link: c.Link, parents: c.Parents, location: c.Location(), + ignoreMatcher: ignoreMatcher, opt: opt, }) if err == nil { @@ -1438,6 +1466,7 @@ func dispatchCopy(d *dispatchState, cfg copyConfig) error { a = a.Copy(st, f, dest, opts...) } } else { + validateCopySourcePath(src, &cfg) var patterns []string if cfg.parents { // detect optional pivot point @@ -1554,6 +1583,7 @@ type copyConfig struct { checksum digest.Digest parents bool location []parser.Range + ignoreMatcher *patternmatcher.PatternMatcher opt dispatchOpt } @@ -1867,6 +1897,27 @@ func addReachableStages(s *dispatchState, stages map[*dispatchState]struct{}) { } } +func validateCopySourcePath(src string, cfg *copyConfig) error { + if cfg.ignoreMatcher == nil { + return nil + } + cmd := "Copy" + if cfg.isAddCommand { + cmd = "Add" + } + + ok, err := cfg.ignoreMatcher.MatchesOrParentMatches(src) + if err != nil { + return err + } + if ok { + msg := linter.RuleCopyIgnoredFile.Format(cmd, src) + cfg.opt.lint.Run(&linter.RuleCopyIgnoredFile, cfg.location, msg) + } + + return nil +} + func validateCircularDependency(states []*dispatchState) error { var visit func(*dispatchState, []instructions.Command) []instructions.Command if states == nil { @@ -2300,6 +2351,31 @@ func reportRedundantTargetPlatform(platformVar string, nameMatch shell.ProcessWo } } +func reportConstPlatformDisallowed(stageName string, nameMatch shell.ProcessWordResult, location []parser.Range, lint *linter.Linter) { + if len(nameMatch.Matched) > 0 || len(nameMatch.Unmatched) > 0 { + // Some substitution happened so the platform was not a constant. + // Disable checking for this warning. + return + } + + // Attempt to parse the platform result. If this fails, then it will fail + // later so just ignore. + p, err := platforms.Parse(nameMatch.Result) + if err != nil { + return + } + + // Check if the platform os or architecture is used in the stage name + // at all. If it is, then disable this warning. + if strings.Contains(stageName, p.OS) || strings.Contains(stageName, p.Architecture) { + return + } + + // Report the linter warning. + msg := linter.RuleFromPlatformFlagConstDisallowed.Format(nameMatch.Result) + lint.Run(&linter.RuleFromPlatformFlagConstDisallowed, location, msg) +} + type instructionTracker struct { Loc []parser.Range IsSet bool diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/linter/ruleset.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/linter/ruleset.go index b333c4c7c2258..d94c32c53ce7f 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/linter/ruleset.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/linter/ruleset.go @@ -148,4 +148,20 @@ var ( return fmt.Sprintf("Default value for ARG %v results in empty or invalid base image name", baseName) }, } + RuleFromPlatformFlagConstDisallowed = LinterRule[func(string) string]{ + Name: "FromPlatformFlagConstDisallowed", + Description: "FROM --platform flag should not use a constant value", + URL: "https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/", + Format: func(platform string) string { + return fmt.Sprintf("FROM --platform flag should not use constant value %q", platform) + }, + } + RuleCopyIgnoredFile = LinterRule[func(string, string) string]{ + Name: "CopyIgnoredFile", + Description: "Attempting to Copy file that is excluded by .dockerignore", + URL: "https://docs.docker.com/go/dockerfile/rule/copy-ignored-file/", + Format: func(cmd, file string) string { + return fmt.Sprintf("Attempting to %s file %q that is excluded by .dockerignore", cmd, file) + }, + } ) diff --git a/vendor/github.com/moby/buildkit/frontend/dockerui/config.go b/vendor/github.com/moby/buildkit/frontend/dockerui/config.go index ea87c4a56cb38..e0f9658aaa285 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerui/config.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerui/config.go @@ -45,28 +45,30 @@ const ( // Don't forget to update frontend documentation if you add // a new build-arg: frontend/dockerfile/docs/reference.md - keyCacheNSArg = "build-arg:BUILDKIT_CACHE_MOUNT_NS" - keyMultiPlatformArg = "build-arg:BUILDKIT_MULTI_PLATFORM" - keyHostnameArg = "build-arg:BUILDKIT_SANDBOX_HOSTNAME" - keyDockerfileLintArg = "build-arg:BUILDKIT_DOCKERFILE_CHECK" - keyContextKeepGitDirArg = "build-arg:BUILDKIT_CONTEXT_KEEP_GIT_DIR" - keySourceDateEpoch = "build-arg:SOURCE_DATE_EPOCH" + keyCacheNSArg = "build-arg:BUILDKIT_CACHE_MOUNT_NS" + keyMultiPlatformArg = "build-arg:BUILDKIT_MULTI_PLATFORM" + keyHostnameArg = "build-arg:BUILDKIT_SANDBOX_HOSTNAME" + keyDockerfileLintArg = "build-arg:BUILDKIT_DOCKERFILE_CHECK" + keyContextKeepGitDirArg = "build-arg:BUILDKIT_CONTEXT_KEEP_GIT_DIR" + keySourceDateEpoch = "build-arg:SOURCE_DATE_EPOCH" + keyCopyIgnoredCheckEnabled = "build-arg:BUILDKIT_DOCKERFILE_CHECK_COPYIGNORED_EXPERIMENT" ) type Config struct { - BuildArgs map[string]string - CacheIDNamespace string - CgroupParent string - Epoch *time.Time - ExtraHosts []llb.HostIP - Hostname string - ImageResolveMode llb.ResolveMode - Labels map[string]string - NetworkMode pb.NetMode - ShmSize int64 - Target string - Ulimits []pb.Ulimit - LinterConfig *linter.Config + BuildArgs map[string]string + CacheIDNamespace string + CgroupParent string + Epoch *time.Time + ExtraHosts []llb.HostIP + Hostname string + ImageResolveMode llb.ResolveMode + Labels map[string]string + NetworkMode pb.NetMode + ShmSize int64 + Target string + Ulimits []pb.Ulimit + LinterConfig *linter.Config + CopyIgnoredCheckEnabled bool CacheImports []client.CacheOptionsEntry TargetPlatforms []ocispecs.Platform // nil means default @@ -286,6 +288,16 @@ func (bc *Client) init() error { return errors.Wrapf(err, "failed to parse %s", keyDockerfileLintArg) } } + + // CopyIgnoredCheckEnabled is an experimental feature to check if COPY is ignored by .dockerignore, + // and it is disabled by default. It is expected that this feature will be enabled by default in a future + // release, and this build-arg will be removed. + if v, ok := opts[keyCopyIgnoredCheckEnabled]; ok { + bc.CopyIgnoredCheckEnabled, err = strconv.ParseBool(v) + if err != nil { + return errors.Wrapf(err, "failed to parse %s", keyCopyIgnoredCheckEnabled) + } + } return nil } @@ -410,44 +422,9 @@ func (bc *Client) MainContext(ctx context.Context, opts ...llb.LocalOption) (*ll return bctx.context, nil } - if bc.dockerignore == nil { - st := llb.Local(bctx.contextLocalName, - llb.SessionID(bc.bopts.SessionID), - llb.FollowPaths([]string{DefaultDockerignoreName}), - llb.SharedKeyHint(bctx.contextLocalName+"-"+DefaultDockerignoreName), - WithInternalName("load "+DefaultDockerignoreName), - llb.Differ(llb.DiffNone, false), - ) - def, err := st.Marshal(ctx, bc.marshalOpts()...) - if err != nil { - return nil, err - } - res, err := bc.client.Solve(ctx, client.SolveRequest{ - Definition: def.ToPB(), - }) - if err != nil { - return nil, err - } - ref, err := res.SingleRef() - if err != nil { - return nil, err - } - dt, _ := ref.ReadFile(ctx, client.ReadRequest{ // ignore error - Filename: DefaultDockerignoreName, - }) - if dt == nil { - dt = []byte{} - } - bc.dockerignore = dt - bc.dockerignoreName = DefaultDockerignoreName - } - - var excludes []string - if len(bc.dockerignore) != 0 { - excludes, err = ignorefile.ReadAll(bytes.NewBuffer(bc.dockerignore)) - if err != nil { - return nil, errors.Wrapf(err, "failed parsing %s", bc.dockerignoreName) - } + excludes, err := bc.dockerIgnorePatterns(ctx, bctx) + if err != nil { + return nil, errors.Wrapf(err, "failed to read dockerignore patterns") } opts = append([]llb.LocalOption{ @@ -493,6 +470,21 @@ func (bc *Client) IsNoCache(name string) bool { return false } +func (bc *Client) DockerIgnorePatterns(ctx context.Context) ([]string, error) { + if bc == nil { + return nil, nil + } + bctx, err := bc.buildContext(ctx) + if err != nil { + return nil, err + } + if bctx.context != nil { + return nil, nil + } + + return bc.dockerIgnorePatterns(ctx, bctx) +} + func DefaultMainContext(opts ...llb.LocalOption) *llb.State { opts = append([]llb.LocalOption{ llb.SharedKeyHint(DefaultLocalNameContext), @@ -505,3 +497,46 @@ func DefaultMainContext(opts ...llb.LocalOption) *llb.State { func WithInternalName(name string) llb.ConstraintsOpt { return llb.WithCustomName("[internal] " + name) } + +func (bc *Client) dockerIgnorePatterns(ctx context.Context, bctx *buildContext) ([]string, error) { + if bc.dockerignore == nil { + st := llb.Local(bctx.contextLocalName, + llb.SessionID(bc.bopts.SessionID), + llb.FollowPaths([]string{DefaultDockerignoreName}), + llb.SharedKeyHint(bctx.contextLocalName+"-"+DefaultDockerignoreName), + WithInternalName("load "+DefaultDockerignoreName), + llb.Differ(llb.DiffNone, false), + ) + def, err := st.Marshal(ctx, bc.marshalOpts()...) + if err != nil { + return nil, err + } + res, err := bc.client.Solve(ctx, client.SolveRequest{ + Definition: def.ToPB(), + }) + if err != nil { + return nil, err + } + ref, err := res.SingleRef() + if err != nil { + return nil, err + } + dt, _ := ref.ReadFile(ctx, client.ReadRequest{ // ignore error + Filename: DefaultDockerignoreName, + }) + if dt == nil { + dt = []byte{} + } + bc.dockerignore = dt + bc.dockerignoreName = DefaultDockerignoreName + } + var err error + var excludes []string + if len(bc.dockerignore) != 0 { + excludes, err = ignorefile.ReadAll(bytes.NewBuffer(bc.dockerignore)) + if err != nil { + return nil, errors.Wrapf(err, "failed parsing %s", bc.dockerignoreName) + } + } + return excludes, nil +} diff --git a/vendor/github.com/moby/buildkit/solver/llbsolver/history.go b/vendor/github.com/moby/buildkit/solver/llbsolver/history.go index 3920711c66a29..e34389d25316f 100644 --- a/vendor/github.com/moby/buildkit/solver/llbsolver/history.go +++ b/vendor/github.com/moby/buildkit/solver/llbsolver/history.go @@ -710,7 +710,7 @@ func (w *Writer) Commit(ctx context.Context) (*ocispecs.Descriptor, func(), erro }, nil } -func (h *HistoryQueue) ImportError(ctx context.Context, err error) (*rpc.Status, *controlapi.Descriptor, func(), error) { +func (h *HistoryQueue) ImportError(ctx context.Context, err error) (_ *rpc.Status, _ *controlapi.Descriptor, _ func(), retErr error) { st, ok := grpcerrors.AsGRPCStatus(grpcerrors.ToGRPC(ctx, err)) if !ok { st = status.New(codes.Unknown, err.Error()) @@ -727,7 +727,11 @@ func (h *HistoryQueue) ImportError(ctx context.Context, err error) (*rpc.Status, return nil, nil, nil, err } - defer w.Discard() + defer func() { + if retErr != nil { + w.Discard() + } + }() if _, err := w.Write(dt); err != nil { return nil, nil, nil, err diff --git a/vendor/github.com/moby/buildkit/solver/llbsolver/solver.go b/vendor/github.com/moby/buildkit/solver/llbsolver/solver.go index 3523a352b67c9..7dc77dc52e43a 100644 --- a/vendor/github.com/moby/buildkit/solver/llbsolver/solver.go +++ b/vendor/github.com/moby/buildkit/solver/llbsolver/solver.go @@ -180,6 +180,9 @@ func (s *Solver) recordBuildHistory(ctx context.Context, id string, req frontend Type: controlapi.BuildHistoryEventType_STARTED, Record: rec, }); err != nil { + if stopTrace != nil { + stopTrace() + } return nil, err } @@ -377,9 +380,10 @@ func (s *Solver) recordBuildHistory(ctx context.Context, id string, req frontend }() if err != nil { - status, desc, release, err := s.history.ImportError(ctx, err) - if err != nil { - return err + status, desc, release, err1 := s.history.ImportError(ctx, err) + if err1 != nil { + // don't replace the build error with this import error + bklog.G(ctx).Errorf("failed to import error to build record: %+v", err1) } rec.ExternalError = desc releasers = append(releasers, release) diff --git a/vendor/github.com/tonistiigi/go-csvvalue/csvvalue.go b/vendor/github.com/tonistiigi/go-csvvalue/csvvalue.go index 727129298d0e4..32d392e4ce87f 100644 --- a/vendor/github.com/tonistiigi/go-csvvalue/csvvalue.go +++ b/vendor/github.com/tonistiigi/go-csvvalue/csvvalue.go @@ -126,6 +126,7 @@ parseField: appendToLast(dst, "\"") line = line[quoteLen:] pos += quoteLen + halfOpen = true case rn == r.Comma: // `",` sequence (end of field). line = line[commaLen:] diff --git a/vendor/modules.txt b/vendor/modules.txt index 755711a3fa782..f8c5bc6e78a3c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -718,7 +718,7 @@ github.com/mitchellh/hashstructure/v2 # github.com/mitchellh/reflectwalk v1.0.2 ## explicit github.com/mitchellh/reflectwalk -# github.com/moby/buildkit v0.15.0-rc1 +# github.com/moby/buildkit v0.15.0-rc2 ## explicit; go 1.21.0 github.com/moby/buildkit/api/services/control github.com/moby/buildkit/api/types @@ -1109,7 +1109,7 @@ github.com/tonistiigi/go-actions-cache # github.com/tonistiigi/go-archvariant v1.0.0 ## explicit; go 1.17 github.com/tonistiigi/go-archvariant -# github.com/tonistiigi/go-csvvalue v0.0.0-20240619222358-bb8dd5cba3c2 +# github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 ## explicit; go 1.16 github.com/tonistiigi/go-csvvalue # github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea