瀏覽代碼

only check the platform of cached image if image found

Signed-off-by: Guillaume Lours <[email protected]>
Guillaume Lours 2 年之前
父節點
當前提交
cd0fc214a5
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      pkg/compose/build.go

+ 5 - 3
pkg/compose/build.go

@@ -251,6 +251,9 @@ func (s *composeService) getLocalImagesDigests(ctx context.Context, project *typ
 	for i, service := range project.Services {
 		imgName := api.GetImageNameOrDefault(service, project.Name)
 		digest, ok := images[imgName]
+		if !ok {
+			continue
+		}
 		if service.Platform != "" {
 			platform, err := platforms.Parse(service.Platform)
 			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