@@ -31,6 +31,7 @@ type NamedContext struct {
3131 bc * Client
3232 name string
3333 nameWithPlatform string
34+ sharedKey string
3435 opt ContextOpt
3536}
3637
@@ -41,12 +42,14 @@ func (bc *Client) namedContext(name string, nameWithPlatform string, opt Context
4142 if ! ok {
4243 return nil , nil
4344 }
45+ sharedKey := opts ["sharedkey:localdir:" + nameWithPlatform ]
4446
4547 return & NamedContext {
4648 input : v ,
4749 bc : bc ,
4850 name : name ,
4951 nameWithPlatform : nameWithPlatform ,
52+ sharedKey : sharedKey ,
5053 opt : opt ,
5154 }, nil
5255}
@@ -265,6 +268,7 @@ func (nc *NamedContext) load(ctx context.Context, count int) (*llb.State, *docke
265268 name : vv [1 ],
266269 nameWithPlatform : nc .nameWithPlatform ,
267270 sessionID : sessionID ,
271+ sharedKey : nc .sharedKey ,
268272 excludes : excludes ,
269273 extraOpts : opt .AsyncLocalOpts ,
270274 }
@@ -310,6 +314,7 @@ type asyncLocalOutput struct {
310314 name string
311315 nameWithPlatform string
312316 sessionID string
317+ sharedKey string
313318 excludes []string
314319 extraOpts func () []llb.LocalOption
315320 once sync.Once
@@ -330,10 +335,11 @@ func (a *asyncLocalOutput) do() {
330335 if a .extraOpts != nil {
331336 extraOpts = a .extraOpts ()
332337 }
338+ sharedKey := "context:" + a .nameWithPlatform + "-" + a .sharedKey
333339 opts := append ([]llb.LocalOption {
334340 llb .WithCustomName ("[context " + a .nameWithPlatform + "] load from client" ),
335341 llb .SessionID (a .sessionID ),
336- llb .SharedKeyHint ("context:" + a . nameWithPlatform ),
342+ llb .SharedKeyHint (sharedKey ),
337343 llb .ExcludePatterns (a .excludes ),
338344 }, extraOpts ... )
339345
0 commit comments