public static WriteSubheading ( string subheading ) : void | ||
subheading | string | |
return | void |
public static Process Execute( ProcessStartInfo info, Func <ProcessStartInfo, Process> executor, bool isDryRun, string errorMessage = null, string executeMessageOverride = null) { Process process = null; if (executeMessageOverride == null) { executeMessageOverride = $"{info.FileName} {info.Arguments}"; } Logger.WriteSubheading($"EXECUTING: {executeMessageOverride}"); if (!isDryRun) { process = executor(info); if (process.ExitCode != 0) { string exceptionMsg = errorMessage ?? $"Failed to execute {info.FileName} {info.Arguments}"; throw new InvalidOperationException(exceptionMsg); } } return(process); }
private string Execute() { Logger.WriteHeading("GENERATING MCR TAGS METADATA"); _imageDocInfos = _repo.FilteredImages .SelectMany(image => image.AllPlatforms.SelectMany(platform => ImageDocumentationInfo.Create(image, platform))) .Where(info => info.DocumentedTags.Any()) .ToList(); StringBuilder yaml = new StringBuilder(); yaml.AppendLine("repos:"); string templatePath = Path.Combine(_manifest.Directory, _repo.Model.McrTagsMetadataTemplate); string template = File.ReadAllText(templatePath); yaml.Append(_manifest.VariableHelper.SubstituteValues(template, GetVariableValue)); if (_imageDocInfos.Any()) { string missingTags = string.Join( Environment.NewLine, _imageDocInfos.Select(info => info.FormattedDocumentedTags)); throw new InvalidOperationException( $"The following tags are not included in the tags metadata: {Environment.NewLine}{missingTags}"); } string metadata = yaml.ToString(); Logger.WriteSubheading("Generated Metadata:"); Logger.WriteMessage(metadata); // Validate that the YAML is in a valid format new DeserializerBuilder() .WithNamingConvention(CamelCaseNamingConvention.Instance) .Build() .Deserialize <TagsMetadata>(metadata); return(metadata); }
public void WriteSubheading(string subheading) { Logger.WriteSubheading(subheading); }