"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/github.com/moby/buildkit/frontend/gateway/container.go" between
moby-20.10.6.tar.gz and moby-20.10.7.tar.gz

About: Moby is a framework to assemble specialized container systems (formerly project name Docker; see here to clarify the relationship between the projects).

container.go  (moby-20.10.6):container.go  (moby-20.10.7)
package gateway package gateway
import ( import (
"context" "context"
"fmt" "fmt"
"path/filepath"
"runtime" "runtime"
"sort" "sort"
"strings" "strings"
"sync" "sync"
"github.com/moby/buildkit/cache" "github.com/moby/buildkit/cache"
"github.com/moby/buildkit/executor" "github.com/moby/buildkit/executor"
"github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/session" "github.com/moby/buildkit/session"
"github.com/moby/buildkit/snapshot" "github.com/moby/buildkit/snapshot"
skipping to change at line 78 skipping to change at line 79
if m.WorkerRef != nil { if m.WorkerRef != nil {
refs = append(refs, m.WorkerRef) refs = append(refs, m.WorkerRef)
m.Mount.Input = opspb.InputIndex(len(refs) - 1) m.Mount.Input = opspb.InputIndex(len(refs) - 1)
} else { } else {
m.Mount.Input = opspb.Empty m.Mount.Input = opspb.Empty
} }
} }
name := fmt.Sprintf("container %s", req.ContainerID) name := fmt.Sprintf("container %s", req.ContainerID)
mm := mounts.NewMountManager(name, w.CacheManager(), sm, w.MetadataStore( )) mm := mounts.NewMountManager(name, w.CacheManager(), sm, w.MetadataStore( ))
p, err := PrepareMounts(ctx, mm, w.CacheManager(), g, mnts, refs, func(m *opspb.Mount, ref cache.ImmutableRef) (cache.MutableRef, error) { p, err := PrepareMounts(ctx, mm, w.CacheManager(), g, "", mnts, refs, fun c(m *opspb.Mount, ref cache.ImmutableRef) (cache.MutableRef, error) {
cm := w.CacheManager() cm := w.CacheManager()
if m.Input != opspb.Empty { if m.Input != opspb.Empty {
cm = refs[m.Input].Worker.CacheManager() cm = refs[m.Input].Worker.CacheManager()
} }
return cm.New(ctx, ref, g) return cm.New(ctx, ref, g)
}) })
if err != nil { if err != nil {
for i := len(p.Actives) - 1; i >= 0; i-- { // call in LIFO order for i := len(p.Actives) - 1; i >= 0; i-- { // call in LIFO order
p.Actives[i].Ref.Release(context.TODO()) p.Actives[i].Ref.Release(context.TODO())
skipping to change at line 135 skipping to change at line 136
} }
type MountMutableRef struct { type MountMutableRef struct {
Ref cache.MutableRef Ref cache.MutableRef
MountIndex int MountIndex int
NoCommit bool NoCommit bool
} }
type MakeMutable func(m *opspb.Mount, ref cache.ImmutableRef) (cache.MutableRef, error) type MakeMutable func(m *opspb.Mount, ref cache.ImmutableRef) (cache.MutableRef, error)
func PrepareMounts(ctx context.Context, mm *mounts.MountManager, cm cache.Manage r, g session.Group, mnts []*opspb.Mount, refs []*worker.WorkerRef, makeMutable M akeMutable) (p PreparedMounts, err error) { func PrepareMounts(ctx context.Context, mm *mounts.MountManager, cm cache.Manage r, g session.Group, cwd string, mnts []*opspb.Mount, refs []*worker.WorkerRef, m akeMutable MakeMutable) (p PreparedMounts, err error) {
// loop over all mounts, fill in mounts, root and outputs // loop over all mounts, fill in mounts, root and outputs
for i, m := range mnts { for i, m := range mnts {
var ( var (
mountable cache.Mountable mountable cache.Mountable
ref cache.ImmutableRef ref cache.ImmutableRef
) )
if m.Dest == opspb.RootMount && m.MountType != opspb.MountType_BI ND { if m.Dest == opspb.RootMount && m.MountType != opspb.MountType_BI ND {
return p, errors.Errorf("invalid mount type %s for %s", m .MountType.String(), m.Dest) return p, errors.Errorf("invalid mount type %s for %s", m .MountType.String(), m.Dest)
} }
skipping to change at line 257 skipping to change at line 258
} }
p.Actives = append(p.Actives, MountMutableRef{ p.Actives = append(p.Actives, MountMutableRef{
MountIndex: i, MountIndex: i,
Ref: active, Ref: active,
}) })
root = active root = active
} }
p.Root = mountWithSession(root, g) p.Root = mountWithSession(root, g)
} else { } else {
mws := mountWithSession(mountable, g) mws := mountWithSession(mountable, g)
mws.Dest = m.Dest dest := m.Dest
if !filepath.IsAbs(filepath.Clean(dest)) {
dest = filepath.Join("/", cwd, dest)
}
mws.Dest = dest
mws.Readonly = m.Readonly mws.Readonly = m.Readonly
mws.Selector = m.Selector mws.Selector = m.Selector
p.Mounts = append(p.Mounts, mws) p.Mounts = append(p.Mounts, mws)
} }
} }
// sort mounts so parents are mounted first // sort mounts so parents are mounted first
sort.Slice(p.Mounts, func(i, j int) bool { sort.Slice(p.Mounts, func(i, j int) bool {
return p.Mounts[i].Dest < p.Mounts[j].Dest return p.Mounts[i].Dest < p.Mounts[j].Dest
}) })
 End of changes. 4 change blocks. 
3 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)