Skip to content

Commit 93d195e

Browse files
authored
Don't AppendDescriptor until we've written config (#1175)
I have a suspicion that this is causing a race where we modify the cache's index.json file before we actually write out the image's config file, so if we call RawConfigFile before we finish caching it, we'll just fail to find that file. Signed-off-by: Jon Johnson <[email protected]>
1 parent 1f21846 commit 93d195e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

pkg/commands/cache.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ func (i *imageCache) get(ctx context.Context, ref name.Reference, missFunc baseF
165165
return result, err
166166
}
167167

168-
if err := i.p.AppendDescriptor(*desc); err != nil {
169-
return result, err
170-
}
171-
172168
if _, ok := result.(v1.ImageIndex); ok {
173169
result = &lazyIndex{
174170
ref: ref,
@@ -202,6 +198,10 @@ func (i *imageCache) get(ctx context.Context, ref name.Reference, missFunc baseF
202198
cache: i,
203199
}
204200
}
201+
202+
if err := i.p.AppendDescriptor(*desc); err != nil {
203+
return result, err
204+
}
205205
}
206206

207207
i.cache.Store(ref.String(), result)

0 commit comments

Comments
 (0)