private List <string> GetPathsToRebuild( IEnumerable <PlatformInfo> allPlatforms, PlatformInfo platform, RepoData repoData) { bool foundImageInfo = false; List <string> pathsToRebuild = new List <string>(); void processPlatformWithMissingImageInfo(PlatformInfo platform) { _loggerService.WriteMessage( $"WARNING: Image info not found for '{platform.DockerfilePath}'. Adding path to build to be queued anyway."); IEnumerable <PlatformInfo> dependentPlatforms = platform.GetDependencyGraph(allPlatforms); pathsToRebuild.AddRange(dependentPlatforms.Select(p => p.Model.Dockerfile)); } if (repoData == null || repoData.Images == null) { processPlatformWithMissingImageInfo(platform); return(pathsToRebuild); } foreach (ImageData imageData in repoData.Images) { PlatformData platformData = imageData.Platforms .FirstOrDefault(platformData => platformData.PlatformInfo == platform); if (platformData != null) { foundImageInfo = true; string fromImage = platform.FinalStageFromImage; string currentDigest; currentDigest = LockHelper.DoubleCheckedLockLookup(_imageDigestsLock, _imageDigests, fromImage, () => { string digest = _manifestToolService.GetManifestDigestSha(ManifestMediaType.Any, fromImage, Options.IsDryRun); return(DockerHelper.GetDigestString(DockerHelper.GetRepo(fromImage), digest)); }); bool rebuildImage = platformData.BaseImageDigest != currentDigest; _loggerService.WriteMessage( $"Checking base image '{fromImage}' from '{platform.DockerfilePath}'{Environment.NewLine}" + $"\tLast build digest: {platformData.BaseImageDigest}{Environment.NewLine}" + $"\tCurrent digest: {currentDigest}{Environment.NewLine}" + $"\tImage is up-to-date: {!rebuildImage}{Environment.NewLine}"); if (rebuildImage) { IEnumerable <PlatformInfo> dependentPlatforms = platform.GetDependencyGraph(allPlatforms); pathsToRebuild.AddRange(dependentPlatforms.Select(p => p.Model.Dockerfile)); } break; } } if (!foundImageInfo) { processPlatformWithMissingImageInfo(platform); } return(pathsToRebuild); }