in tooling/pipeline-documentation/pkg/generator/markdown.go [43:86]
func writeDetails(entrypoints []topology.Entrypoint, service topology.Service, into io.WriteCloser, depth int) error {
summary := bytes.Buffer{}
for i := 0; i < depth; i++ {
summary.WriteString(" ")
}
summary.WriteString(fmt.Sprintf("- %s", service.ServiceGroup))
if pipeline, ok := service.Metadata["pipeline"]; ok {
summary.WriteString(fmt.Sprintf(" ([ref](https://github.com/Azure/ARO-HCP/tree/main/%s))", pipeline))
}
if purpose, ok := service.Metadata["purpose"]; ok {
summary.WriteString(fmt.Sprintf(": %s", purpose))
}
if links, ok := formatPipelineLinks(service.Metadata); ok {
summary.WriteString(" " + links)
}
for _, entrypoint := range entrypoints {
if entrypoint.Identifier == service.ServiceGroup {
reference := ""
if name, ok := entrypoint.Metadata["name"]; ok {
reference += name
}
if links, ok := formatPipelineLinks(entrypoint.Metadata); ok {
reference += " " + links
}
if reference != "" {
summary.WriteString(fmt.Sprintf(" (%s)", reference))
}
}
}
summary.WriteString("\n")
if _, err := into.Write(summary.Bytes()); err != nil {
return fmt.Errorf("failed to write details: %w", err)
}
for _, child := range service.Children {
if err := writeDetails(entrypoints, child, into, depth+1); err != nil {
return err
}
}
return nil
}