mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-16 05:16:08 +02:00
docs: change secret docs (#1984)
* change secret docs * link to credentials in resource reference * cleanup * correct type * add configuration scope * correct test case
This commit is contained in:
parent
dc9a6d7b2b
commit
666923e651
@ -252,6 +252,26 @@ func createParameterDetails(stepData *config.StepData) string {
|
||||
details += "\n\n"
|
||||
}
|
||||
|
||||
for _, secret := range stepData.Spec.Inputs.Secrets {
|
||||
details += fmt.Sprintf("#### %v\n\n", secret.Name)
|
||||
|
||||
if !contains(stepParameterNames, secret.Name) {
|
||||
details += "**Jenkins-specific:** Used for proper environment setup.\n\n"
|
||||
}
|
||||
|
||||
details += secret.Description + "\n\n"
|
||||
|
||||
details += "[back to overview](#parameters)\n\n"
|
||||
|
||||
details += "| Scope | Details |\n"
|
||||
details += "| ---- | --------- |\n"
|
||||
details += fmt.Sprintf("| Aliases | %v |\n", aliasList(secret.Aliases))
|
||||
details += fmt.Sprintf("| Type | `%v` |\n", "string")
|
||||
details += fmt.Sprintf("| Configuration scope | %v |\n", scopeDetails([]string{"PARAMETERS", "GENERAL", "STEPS", "STAGES"}))
|
||||
|
||||
details += "\n\n"
|
||||
}
|
||||
|
||||
return details
|
||||
}
|
||||
|
||||
@ -365,7 +385,7 @@ func resourceReferenceDetails(resourceRef []config.ResourceReference) string {
|
||||
}
|
||||
resourceDetails += fmt.Sprintf(" - `%v`%v<br />", alias.Name, ifThenElse(alias.Deprecated, " (**Deprecated**)", ""))
|
||||
}
|
||||
resourceDetails += fmt.Sprintf(" id: `%v`<br />", resource.Name)
|
||||
resourceDetails += fmt.Sprintf(" id: [`%v`](#%v)<br />", resource.Name, strings.ToLower(resource.Name))
|
||||
resourceDetails += fmt.Sprintf(" reference to: `%v`<br />", resource.Param)
|
||||
continue
|
||||
}
|
||||
@ -382,9 +402,6 @@ func handleStepParameters(stepData *config.StepData) {
|
||||
//ToDo: add to context.yaml
|
||||
appendGeneralOptionsToParameters(stepData)
|
||||
|
||||
//add secrets to step parameters
|
||||
appendSecretsToParameters(stepData)
|
||||
|
||||
//consolidate conditional parameters:
|
||||
//- remove duplicate parameter entries
|
||||
//- combine defaults (consider conditions)
|
||||
|
@ -42,25 +42,25 @@ func configOpenDocTemplateFileMock(docTemplateFilePath string) (io.ReadCloser, e
|
||||
meta1 := `# ${docGenStepName}
|
||||
|
||||
## ${docGenDescription}
|
||||
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
||||
none
|
||||
|
||||
## ${docJenkinsPluginDependencies}
|
||||
|
||||
|
||||
## ${docGenParameters}
|
||||
|
||||
|
||||
## ${docGenConfiguration}
|
||||
|
||||
|
||||
## Side effects
|
||||
|
||||
|
||||
none
|
||||
|
||||
|
||||
## Exceptions
|
||||
|
||||
|
||||
none
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
none
|
||||
@ -365,7 +365,7 @@ func TestResourceReferenceDetails(t *testing.T) {
|
||||
resourceRef: []config.ResourceReference{
|
||||
{Name: "testCredentialId", Aliases: []config.Alias{}, Type: "secret", Param: "password"},
|
||||
},
|
||||
expected: "Jenkins credential id:<br /> id: `testCredentialId`<br /> reference to: `password`<br />",
|
||||
expected: "Jenkins credential id:<br /> id: [`testCredentialId`](#testcredentialid)<br /> reference to: `password`<br />",
|
||||
},
|
||||
{
|
||||
resourceRef: []config.ResourceReference{
|
||||
|
Loading…
Reference in New Issue
Block a user