private static void ExecuteManifest() { WriteHeading("GENERATING MANIFESTS"); foreach (ImageInfo imageInfo in RepoInfo.Images) { foreach (string tag in imageInfo.Model.SharedTags) { string manifestYml = $@"image: {RepoInfo.Model.DockerRepo}:{tag} manifests: "; foreach (KeyValuePair <string, Platform> kvp in imageInfo.Model.Platforms) { manifestYml += $@" - image: {RepoInfo.Model.DockerRepo}:{kvp.Value.Tags.First()} platform: architecture: amd64 os: {kvp.Key} "; } Console.WriteLine($"-- PUBLISHING MANIFEST:{Environment.NewLine}{manifestYml}"); File.WriteAllText("manifest.yml", manifestYml); ExecuteHelper.Execute( "manifest-tool", $"--username {Options.Username} --password {Options.Password} push from-spec manifest.yml", Options.IsDryRun); } } }
private static void PushImages() { if (Options.IsPushEnabled) { WriteHeading("PUSHING IMAGES"); if (Options.Username != null) { string loginArgsWithoutPassword = $"login -u {Options.Username} -p"; ExecuteHelper.Execute( "docker", $"{loginArgsWithoutPassword} {Options.Password}", Options.IsDryRun, executeMessageOverride: $"{loginArgsWithoutPassword} ********"); } foreach (string tag in RepoInfo.GetPlatformTags()) { ExecuteHelper.ExecuteWithRetry("docker", $"push {tag}", Options.IsDryRun); } if (Options.Username != null) { ExecuteHelper.Execute("docker", $"logout", Options.IsDryRun); } } }
private static void RunTests() { if (!Options.IsTestRunDisabled) { WriteHeading("TESTING IMAGES"); foreach (string command in RepoInfo.TestCommands) { string[] parts = command.Split(' '); ExecuteHelper.Execute( parts[0], command.Substring(parts[0].Length + 1), Options.IsDryRun); } } }
private static void BuildImages() { WriteHeading("BUILDING IMAGES"); foreach (ImageInfo imageInfo in RepoInfo.Images.Where(image => image.Platform != null)) { Console.WriteLine($"-- BUILDING: {imageInfo.Platform.Model.Dockerfile}"); if (!Options.IsSkipPullingEnabled && imageInfo.Platform.IsExternalFromImage) { // Ensure latest base image exists locally before building ExecuteHelper.ExecuteWithRetry("docker", $"pull {imageInfo.Platform.FromImage}", Options.IsDryRun); } ExecuteHelper.Execute( "docker", $"build -t {string.Join(" -t ", imageInfo.Tags)} {imageInfo.Platform.Model.Dockerfile}", Options.IsDryRun); } }