"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.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).

exec.go  (moby-20.10.6):exec.go  (moby-20.10.7)
skipping to change at line 72 skipping to change at line 72
func cloneExecOp(old *pb.ExecOp) pb.ExecOp { func cloneExecOp(old *pb.ExecOp) pb.ExecOp {
n := *old n := *old
meta := *n.Meta meta := *n.Meta
meta.ExtraHosts = nil meta.ExtraHosts = nil
for i := range n.Meta.ExtraHosts { for i := range n.Meta.ExtraHosts {
h := *n.Meta.ExtraHosts[i] h := *n.Meta.ExtraHosts[i]
meta.ExtraHosts = append(meta.ExtraHosts, &h) meta.ExtraHosts = append(meta.ExtraHosts, &h)
} }
n.Meta = &meta n.Meta = &meta
n.Mounts = nil n.Mounts = nil
for i := range n.Mounts { for i := range old.Mounts {
m := *n.Mounts[i] m := *old.Mounts[i]
n.Mounts = append(n.Mounts, &m) n.Mounts = append(n.Mounts, &m)
} }
return n return n
} }
func (e *execOp) CacheMap(ctx context.Context, g session.Group, index int) (*sol ver.CacheMap, bool, error) { func (e *execOp) CacheMap(ctx context.Context, g session.Group, index int) (*sol ver.CacheMap, bool, error) {
op := cloneExecOp(e.op) op := cloneExecOp(e.op)
for i := range op.Meta.ExtraHosts { for i := range op.Meta.ExtraHosts {
h := op.Meta.ExtraHosts[i] h := op.Meta.ExtraHosts[i]
h.IP = "" h.IP = ""
skipping to change at line 100 skipping to change at line 100
p := platforms.DefaultSpec() p := platforms.DefaultSpec()
if e.platform != nil { if e.platform != nil {
p = specs.Platform{ p = specs.Platform{
OS: e.platform.OS, OS: e.platform.OS,
Architecture: e.platform.Architecture, Architecture: e.platform.Architecture,
Variant: e.platform.Variant, Variant: e.platform.Variant,
} }
} }
// Special case for cache compatibility with buggy versions that wrongly
// excluded Exec.Mounts: for the default case of one root mount (i.e. RUN
// inside a Dockerfile), do not include the mount when generating the cac
he
// map.
if len(op.Mounts) == 1 &&
op.Mounts[0].Dest == "/" &&
op.Mounts[0].Selector == "" &&
!op.Mounts[0].Readonly &&
op.Mounts[0].MountType == pb.MountType_BIND &&
op.Mounts[0].CacheOpt == nil &&
op.Mounts[0].SSHOpt == nil &&
op.Mounts[0].SecretOpt == nil &&
op.Mounts[0].ResultID == "" {
op.Mounts = nil
}
dt, err := json.Marshal(struct { dt, err := json.Marshal(struct {
Type string Type string
Exec *pb.ExecOp Exec *pb.ExecOp
OS string OS string
Arch string Arch string
Variant string `json:",omitempty"` Variant string `json:",omitempty"`
}{ }{
Type: execCacheType, Type: execCacheType,
Exec: &op, Exec: &op,
OS: p.OS, OS: p.OS,
skipping to change at line 227 skipping to change at line 243
func (e *execOp) Exec(ctx context.Context, g session.Group, inputs []solver.Resu lt) (results []solver.Result, err error) { func (e *execOp) Exec(ctx context.Context, g session.Group, inputs []solver.Resu lt) (results []solver.Result, err error) {
refs := make([]*worker.WorkerRef, len(inputs)) refs := make([]*worker.WorkerRef, len(inputs))
for i, inp := range inputs { for i, inp := range inputs {
var ok bool var ok bool
refs[i], ok = inp.Sys().(*worker.WorkerRef) refs[i], ok = inp.Sys().(*worker.WorkerRef)
if !ok { if !ok {
return nil, errors.Errorf("invalid reference for exec %T" , inp.Sys()) return nil, errors.Errorf("invalid reference for exec %T" , inp.Sys())
} }
} }
p, err := gateway.PrepareMounts(ctx, e.mm, e.cm, g, e.op.Mounts, refs, fu nc(m *pb.Mount, ref cache.ImmutableRef) (cache.MutableRef, error) { p, err := gateway.PrepareMounts(ctx, e.mm, e.cm, g, e.op.Meta.Cwd, e.op.M ounts, refs, func(m *pb.Mount, ref cache.ImmutableRef) (cache.MutableRef, error) {
desc := fmt.Sprintf("mount %s from exec %s", m.Dest, strings.Join (e.op.Meta.Args, " ")) desc := fmt.Sprintf("mount %s from exec %s", m.Dest, strings.Join (e.op.Meta.Args, " "))
return e.cm.New(ctx, ref, g, cache.WithDescription(desc)) return e.cm.New(ctx, ref, g, cache.WithDescription(desc))
}) })
defer func() { defer func() {
if err != nil { if err != nil {
execInputs := make([]solver.Result, len(e.op.Mounts)) execInputs := make([]solver.Result, len(e.op.Mounts))
for i, m := range e.op.Mounts { for i, m := range e.op.Mounts {
if m.Input == -1 { if m.Input == -1 {
continue continue
} }
 End of changes. 3 change blocks. 
3 lines changed or deleted 20 lines changed or added

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