private static bool ArePlatformsEqual(PlatformData platformData, ImageData imageData, PlatformInfo platform, ImageInfo manifestImage) { PlatformData otherPlatform = PlatformData.FromPlatformInfo(platform, manifestImage); // We can't use PlatformData.CompareTo here because it relies on having its PlatformInfo and ImageInfo values fully populated // which is what this class is trying to make happen. return(!platformData.HasDifferentTagState(otherPlatform) && platformData.GetIdentifier(excludeProductVersion: true) == otherPlatform.GetIdentifier(excludeProductVersion: true) && AreProductVersionsEquivalent(imageData.ProductVersion, manifestImage.ProductVersion)); }
private PlatformData?CreatePlatformData(ImageInfo image, PlatformInfo platform) { if (Options.ImageInfoOutputPath is null) { return(null); } PlatformData?platformData = PlatformData.FromPlatformInfo(platform, image); platformData.SimpleTags = GetPushTags(platform.Tags) .Select(tag => tag.Name) .OrderBy(name => name) .ToList(); return(platformData); }
private void BuildImages() { this.loggerService.WriteHeading("BUILDING IMAGES"); foreach (RepoInfo repoInfo in Manifest.FilteredRepos) { RepoData repoData = new RepoData { Repo = repoInfo.Name }; imageArtifactDetails.Repos.Add(repoData); foreach (ImageInfo image in repoInfo.FilteredImages) { ImageData imageData = new ImageData { ProductVersion = image.ProductVersion }; if (image.SharedTags.Any()) { imageData.Manifest = new ManifestData { SharedTags = image.SharedTags .Select(tag => tag.Name) .ToList() }; } repoData.Images.Add(imageData); foreach (PlatformInfo platform in image.FilteredPlatforms) { PlatformData platformData = PlatformData.FromPlatformInfo(platform); imageData.Platforms.Add(platformData); bool createdPrivateDockerfile = UpdateDockerfileFromCommands(platform, out string dockerfilePath); IEnumerable <string> allTags; try { InvokeBuildHook("pre-build", platform.BuildContextPath); // Tag the built images with the shared tags as well as the platform tags. // Some tests and image FROM instructions depend on these tags. allTags = platform.Tags .Concat(image.SharedTags) .Select(tag => tag.FullyQualifiedName) .ToList(); this.dockerService.BuildImage( dockerfilePath, platform.BuildContextPath, allTags, platform.BuildArgs, Options.IsRetryEnabled, Options.IsDryRun); if (!Options.IsDryRun) { EnsureArchitectureMatches(platform, allTags); } InvokeBuildHook("post-build", platform.BuildContextPath); } finally { if (createdPrivateDockerfile) { File.Delete(dockerfilePath); } } platformData.BaseImageDigest = this.dockerService.GetImageDigest(platform.FinalStageFromImage, Options.IsDryRun); platformData.SimpleTags = GetPushTags(platform.Tags) .Select(tag => tag.Name) .OrderBy(name => name) .ToList(); platformData.FullyQualifiedSimpleTags = platformData.SimpleTags .Select(tag => TagInfo.GetFullyQualifiedName(repoInfo.QualifiedName, tag)) .ToList(); platformData.AllTags = allTags; } } } }