Merge pull request #3618 from tonistiigi/buildx-context-reuse

build: send individual shared keys for local build contexts
This commit is contained in:
Tõnis Tiigi
2026-02-09 15:40:10 -08:00
committed by GitHub
+14 -1
View File
@@ -546,8 +546,14 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt *O
}
// add node identifier to shared key if one was specified
nodeID := cfg.TryNodeIdentifier()
if so.SharedKey != "" {
so.SharedKey += ":" + cfg.TryNodeIdentifier()
so.SharedKey += ":" + nodeID
}
for k, v := range so.FrontendAttrs {
if strings.HasPrefix(k, "sharedkey:localdir:") {
so.FrontendAttrs[k] = v + ":" + nodeID
}
}
if opt.Pull {
@@ -855,6 +861,13 @@ func loadInputs(ctx context.Context, d *driver.DriverHandle, inp *Inputs, pw pro
return nil, err
}
target.FrontendAttrs["context:"+k] = "local:" + localName
sharedKey := v.Path
if p, err := filepath.Abs(sharedKey); err == nil {
sharedKey = filepath.Base(p)
} else {
sharedKey = filepath.Base(sharedKey)
}
target.FrontendAttrs["sharedkey:localdir:"+k] = sharedKey
}
release := func() {