mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-04-13 11:50:43 +02:00
Modify document generator to include GHA (#5190)
* include GHA in documentation * add some missing GHA places * add some missing GHA places * Correct step description
This commit is contained in:
parent
28fb2b77bf
commit
e8d745052a
@ -32,12 +32,13 @@ func main() {
|
|||||||
var docTemplatePath string
|
var docTemplatePath string
|
||||||
var customLibraryStepFile string
|
var customLibraryStepFile string
|
||||||
var customDefaultFiles sliceFlags
|
var customDefaultFiles sliceFlags
|
||||||
var includeAzure bool
|
var includeAzure, includeGHA bool
|
||||||
flag.StringVar(&metadataPath, "metadataDir", "./resources/metadata", "The directory containing the step metadata. Default points to \\'resources/metadata\\'.")
|
flag.StringVar(&metadataPath, "metadataDir", "./resources/metadata", "The directory containing the step metadata. Default points to \\'resources/metadata\\'.")
|
||||||
flag.StringVar(&docTemplatePath, "docuDir", "./documentation/docs/steps/", "The directory containing the docu stubs. Default points to \\'documentation/docs/steps/\\'.")
|
flag.StringVar(&docTemplatePath, "docuDir", "./documentation/docs/steps/", "The directory containing the docu stubs. Default points to \\'documentation/docs/steps/\\'.")
|
||||||
flag.StringVar(&customLibraryStepFile, "customLibraryStepFile", "", "")
|
flag.StringVar(&customLibraryStepFile, "customLibraryStepFile", "", "")
|
||||||
flag.Var(&customDefaultFiles, "customDefaultFile", "Path to a custom default configuration file.")
|
flag.Var(&customDefaultFiles, "customDefaultFile", "Path to a custom default configuration file.")
|
||||||
flag.BoolVar(&includeAzure, "includeAzure", false, "Include Azure-specifics in step documentation.")
|
flag.BoolVar(&includeAzure, "includeAzure", false, "Include Azure-specifics in step documentation.")
|
||||||
|
flag.BoolVar(&includeGHA, "includeGHA", false, "Include GitHub Actions-specifics in step documentation.")
|
||||||
|
|
||||||
// flags for stage documentation
|
// flags for stage documentation
|
||||||
var generateStageConfig bool
|
var generateStageConfig bool
|
||||||
@ -85,7 +86,7 @@ func main() {
|
|||||||
OpenDocTemplateFile: openDocTemplateFile,
|
OpenDocTemplateFile: openDocTemplateFile,
|
||||||
DocFileWriter: writeFile,
|
DocFileWriter: writeFile,
|
||||||
OpenFile: openFile,
|
OpenFile: openFile,
|
||||||
}, includeAzure)
|
}, includeAzure, includeGHA)
|
||||||
checkError(err)
|
checkError(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,8 @@ const (
|
|||||||
headlineUsage = "## Usage\n\n"
|
headlineUsage = "## Usage\n\n"
|
||||||
headlineJenkinsPipeline = " === \"Jenkins\"\n\n"
|
headlineJenkinsPipeline = " === \"Jenkins\"\n\n"
|
||||||
headlineCommandLine = " === \"Command Line\"\n\n"
|
headlineCommandLine = " === \"Command Line\"\n\n"
|
||||||
headlineAzure = " === \"Azure\"\n\n"
|
headlineAzure = " === \"Azure DevOps\"\n\n"
|
||||||
|
headlineGHA = " === \"GitHub Actions\"\n\n"
|
||||||
spacingTabBox = " "
|
spacingTabBox = " "
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -67,6 +68,19 @@ func createDescriptionSection(stepData *config.StepData) string {
|
|||||||
description += fmt.Sprintf("%v```\n\n", spacingTabBox)
|
description += fmt.Sprintf("%v```\n\n", spacingTabBox)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add GiHub Actions specific information if activated
|
||||||
|
if includeGHA {
|
||||||
|
description += headlineGHA
|
||||||
|
description += fmt.Sprintf("%v```\n", spacingTabBox)
|
||||||
|
description += fmt.Sprintf("%vsteps:\n", spacingTabBox)
|
||||||
|
description += fmt.Sprintf("%v - name: your preferred name for the step\n", spacingTabBox)
|
||||||
|
description += fmt.Sprintf("%v uses: SAP/project-piper-action@main\n", spacingTabBox)
|
||||||
|
description += fmt.Sprintf("%v with:\n", spacingTabBox)
|
||||||
|
description += fmt.Sprintf("%v step-name: %v\n", spacingTabBox, stepData.Metadata.Name)
|
||||||
|
description += fmt.Sprintf("%v flags: --anyStepParameter\n", spacingTabBox)
|
||||||
|
description += fmt.Sprintf("%v```\n\n", spacingTabBox)
|
||||||
|
}
|
||||||
|
|
||||||
// add command line information
|
// add command line information
|
||||||
description += headlineCommandLine
|
description += headlineCommandLine
|
||||||
description += fmt.Sprintf("%v```sh\n", spacingTabBox)
|
description += fmt.Sprintf("%v```sh\n", spacingTabBox)
|
||||||
|
@ -25,7 +25,7 @@ type DocuHelperData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var stepParameterNames []string
|
var stepParameterNames []string
|
||||||
var includeAzure bool
|
var includeAzure, includeGHA bool
|
||||||
|
|
||||||
func readStepConfiguration(stepMetadata config.StepData, customDefaultFiles []string, docuHelperData DocuHelperData) config.StepConfig {
|
func readStepConfiguration(stepMetadata config.StepData, customDefaultFiles []string, docuHelperData DocuHelperData) config.StepConfig {
|
||||||
filters := stepMetadata.GetParameterFilters()
|
filters := stepMetadata.GetParameterFilters()
|
||||||
@ -58,8 +58,9 @@ func readStepConfiguration(stepMetadata config.StepData, customDefaultFiles []st
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GenerateStepDocumentation generates step coding based on step configuration provided in yaml files
|
// GenerateStepDocumentation generates step coding based on step configuration provided in yaml files
|
||||||
func GenerateStepDocumentation(metadataFiles []string, customDefaultFiles []string, docuHelperData DocuHelperData, azure bool) error {
|
func GenerateStepDocumentation(metadataFiles []string, customDefaultFiles []string, docuHelperData DocuHelperData, azure bool, githubAction bool) error {
|
||||||
includeAzure = azure
|
includeAzure = azure
|
||||||
|
includeGHA = githubAction
|
||||||
for key := range metadataFiles {
|
for key := range metadataFiles {
|
||||||
stepMetadata := readStepMetadata(metadataFiles[key], docuHelperData)
|
stepMetadata := readStepMetadata(metadataFiles[key], docuHelperData)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user