github.com/ouraigua/jenkins-library@v0.0.0-20231028010029-fbeaf2f3aa9b/pkg/documentation/generator/outputs.go (about) 1 package generator 2 3 import ( 4 "fmt" 5 6 "github.com/SAP/jenkins-library/pkg/config" 7 ) 8 9 func stepOutputs(stepData *config.StepData) string { 10 if len(stepData.Spec.Outputs.Resources) == 0 { 11 return "" 12 } 13 14 stepOutput := "\n## Outputs\n\n" 15 stepOutput += "| Output type | Details |\n" 16 stepOutput += "| ----------- | ------- |\n" 17 18 for _, res := range stepData.Spec.Outputs.Resources { 19 //handle commonPipelineEnvironment output 20 if res.Type == "piperEnvironment" { 21 stepOutput += fmt.Sprintf("| %v | <ul>", res.Name) 22 for _, param := range res.Parameters { 23 stepOutput += fmt.Sprintf("<li>%v</li>", param["name"]) 24 } 25 stepOutput += "</ul> |\n" 26 } 27 28 //handle Influx output 29 if res.Type == "influx" { 30 stepOutput += fmt.Sprintf("| %v | ", res.Name) 31 for _, param := range res.Parameters { 32 stepOutput += fmt.Sprintf("measurement `%v`<br /><ul>", param["name"]) 33 fields, _ := param["fields"].([]interface{}) 34 for _, field := range fields { 35 fieldMap, _ := field.(map[string]interface{}) 36 stepOutput += fmt.Sprintf("<li>%v</li>", fieldMap["name"]) 37 } 38 } 39 stepOutput += "</ul> |\n" 40 } 41 42 } 43 return stepOutput 44 }