@@ -183,6 +183,7 @@ func (is *Source) Resolve(ctx context.Context, id source.Identifier, sm *session
183
183
type puller struct {
184
184
is * Source
185
185
resolveLocalOnce sync.Once
186
+ g flightcontrol.Group
186
187
src * source.ImageIdentifier
187
188
desc ocispec.Descriptor
188
189
ref string
@@ -253,9 +254,7 @@ func (p *puller) resolveLocal() {
253
254
}
254
255
255
256
func (p * puller ) resolve (ctx context.Context , g session.Group ) error {
256
- // key is used to synchronize resolutions that can happen in parallel when doing multi-stage.
257
- key := "resolve::" + p .ref + "::" + platforms .Format (p .platform )
258
- _ , err := p .is .g .Do (ctx , key , func (ctx context.Context ) (_ interface {}, err error ) {
257
+ _ , err := p .g .Do (ctx , "" , func (ctx context.Context ) (_ interface {}, err error ) {
259
258
resolveProgressDone := oneOffProgress (ctx , "resolve " + p .src .Reference .String ())
260
259
defer func () {
261
260
resolveProgressDone (err )
@@ -329,6 +328,10 @@ func (p *puller) CacheKey(ctx context.Context, g session.Group, index int) (stri
329
328
return dgst .String (), nil , false , nil
330
329
}
331
330
331
+ if len (p .config ) == 0 {
332
+ return "" , nil , false , errors .Errorf ("invalid empty config file resolved for %s" , p .src .Reference .String ())
333
+ }
334
+
332
335
k := cacheKeyFromConfig (p .config ).String ()
333
336
if k == "" {
334
337
dgst , err := p .mainManifestKey (p .platform )
@@ -360,8 +363,10 @@ func (p *puller) getRef(ctx context.Context, diffIDs []layer.DiffID, opts ...cac
360
363
361
364
func (p * puller ) Snapshot (ctx context.Context , g session.Group ) (cache.ImmutableRef , error ) {
362
365
p .resolveLocal ()
363
- if err := p .resolve (ctx , g ); err != nil {
364
- return nil , err
366
+ if len (p .config ) == 0 {
367
+ if err := p .resolve (ctx , g ); err != nil {
368
+ return nil , err
369
+ }
365
370
}
366
371
367
372
if p .config != nil {
@@ -801,6 +806,7 @@ func cacheKeyFromConfig(dt []byte) digest.Digest {
801
806
var img ocispec.Image
802
807
err := json .Unmarshal (dt , & img )
803
808
if err != nil {
809
+ logrus .WithError (err ).Errorf ("failed to unmarshal image config for cache key %v" , err )
804
810
return digest .FromBytes (dt )
805
811
}
806
812
if img .RootFS .Type != "layers" || len (img .RootFS .DiffIDs ) == 0 {
0 commit comments