(service *types.ServiceConfig, images map[string]api.ImageSummary, projectName string)
| 167 | } |
| 168 | |
| 169 | func resolveImageVolumes(service *types.ServiceConfig, images map[string]api.ImageSummary, projectName string) { |
| 170 | for i, vol := range service.Volumes { |
| 171 | if vol.Type == types.VolumeTypeImage { |
| 172 | imgName := vol.Source |
| 173 | if _, ok := images[vol.Source]; !ok { |
| 174 | // check if source is another service in the project |
| 175 | imgName = api.GetImageNameOrDefault(types.ServiceConfig{Name: vol.Source}, projectName) |
| 176 | // If we still can't find it, it might be an external image that wasn't pulled yet or doesn't exist |
| 177 | if _, ok := images[imgName]; !ok { |
| 178 | continue |
| 179 | } |
| 180 | } |
| 181 | if img, ok := images[imgName]; ok { |
| 182 | // Use Image ID directly as source. |
| 183 | // Using name@digest format (via reference.WithDigest) fails for local-only images |
| 184 | // that don't have RepoDigests (e.g. built locally in CI). |
| 185 | // Image ID (sha256:...) is always valid and ensures ServiceHash changes on rebuild. |
| 186 | service.Volumes[i].Source = img.ID |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | func (s *composeService) getLocalImagesDigests(ctx context.Context, project *types.Project) (map[string]api.ImageSummary, error) { |
| 193 | imageNames := utils.Set[string]{} |
no test coverage detected