Skip to content

Commit

Permalink
provide DescHandlers to GetMutable always
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Sipsma <[email protected]>
  • Loading branch information
sipsma committed Dec 6, 2024
1 parent fc4ecad commit 867e8fd
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions solver/llbsolver/mounts/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/moby/buildkit/util/grpcerrors"
"github.com/moby/locker"
"github.com/moby/sys/userns"
digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
"google.golang.org/grpc/codes"
)
Expand Down Expand Up @@ -124,17 +123,11 @@ func (g *cacheRefGetter) getRefCacheDirNoCache(ctx context.Context, key string,
}
locked := false
for _, si := range sis {
mRef, err := g.cm.GetMutable(ctx, si.ID())
var needsRemoteProviders cache.NeedsRemoteProviderError
if errors.As(err, &needsRemoteProviders) && ref != nil {
descHandlers := cache.DescHandlers(make(map[digest.Digest]*cache.DescHandler))
for _, dgstDescPair := range needsRemoteProviders {
if handler := ref.DescHandler(dgstDescPair.Digest); handler != nil {
descHandlers[dgstDescPair.Digest] = handler
}
}
mRef, err = g.cm.GetMutable(ctx, si.ID(), descHandlers)
var opts []cache.RefOption
if ref != nil {
opts = append(opts, ref.DescHandlers())
}
mRef, err := g.cm.GetMutable(ctx, si.ID(), opts...)
if err == nil {
bklog.G(ctx).Debugf("reusing ref for cache dir %q: %s", id, mRef.ID())
return mRef, nil
Expand Down

0 comments on commit 867e8fd

Please sign in to comment.