only check the platform of cached image if image found

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
Guillaume Lours 2023-05-16 23:47:56 +02:00 committed by Nicolas De loof
parent 9b5a4588f9
commit cd0fc214a5
1 changed files with 5 additions and 3 deletions

View File

@ -251,6 +251,9 @@ func (s *composeService) getLocalImagesDigests(ctx context.Context, project *typ
for i, service := range project.Services { for i, service := range project.Services {
imgName := api.GetImageNameOrDefault(service, project.Name) imgName := api.GetImageNameOrDefault(service, project.Name)
digest, ok := images[imgName] digest, ok := images[imgName]
if !ok {
continue
}
if service.Platform != "" { if service.Platform != "" {
platform, err := platforms.Parse(service.Platform) platform, err := platforms.Parse(service.Platform)
if err != nil { if err != nil {
@ -271,9 +274,8 @@ func (s *composeService) getLocalImagesDigests(ctx context.Context, project *typ
} }
} }
if ok { project.Services[i].CustomLabels.Add(api.ImageDigestLabel, digest)
project.Services[i].CustomLabels.Add(api.ImageDigestLabel, digest)
}
} }
return images, nil return images, nil