Skip to content

Commit cd0fc21

Browse files
gloursndeloof
authored andcommitted
only check the platform of cached image if image found
Signed-off-by: Guillaume Lours <[email protected]>
1 parent 9b5a458 commit cd0fc21

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/compose/build.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ func (s *composeService) getLocalImagesDigests(ctx context.Context, project *typ
251251
for i, service := range project.Services {
252252
imgName := api.GetImageNameOrDefault(service, project.Name)
253253
digest, ok := images[imgName]
254+
if !ok {
255+
continue
256+
}
254257
if service.Platform != "" {
255258
platform, err := platforms.Parse(service.Platform)
256259
if err != nil {
@@ -271,9 +274,8 @@ func (s *composeService) getLocalImagesDigests(ctx context.Context, project *typ
271274
}
272275
}
273276

274-
if ok {
275-
project.Services[i].CustomLabels.Add(api.ImageDigestLabel, digest)
276-
}
277+
project.Services[i].CustomLabels.Add(api.ImageDigestLabel, digest)
278+
277279
}
278280

279281
return images, nil

0 commit comments

Comments
 (0)