mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
handlePipelineStepErrors: generate docu
This commit is contained in:
parent
b1d8032ee2
commit
f77d9957a5
@ -1,55 +1,17 @@
|
||||
# handlePipelineStepErrors
|
||||
# ${docGenStepName}
|
||||
|
||||
## Description
|
||||
|
||||
Used by other steps to make error analysis easier. Lists parameters and other data available to the step in which the error occurs.
|
||||
## ${docGenDescription}
|
||||
|
||||
## Prerequisites
|
||||
|
||||
none
|
||||
|
||||
## Parameters
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -----------------|-----------|---------|-----------------|
|
||||
| `stepParameters` | yes | | |
|
||||
| `stepName` | yes | | |
|
||||
| `echoDetails` | yes | true | true, false |
|
||||
|
||||
* `stepParameters` - The parameters from the step to be executed. The list of parameters is then shown in the console output.
|
||||
* `stepName` - The name of the step executed to be shown in the console output.
|
||||
* `echoDetails` - If set to true the following will be output to the console:
|
||||
1. Step beginning: `--- Begin library step: ${stepName}.groovy ---`
|
||||
2. Step end: `--- End library step: ${stepName}.groovy ---`
|
||||
3. Step errors:
|
||||
|
||||
```log
|
||||
----------------------------------------------------------
|
||||
--- An error occurred in the library step: ${stepName}
|
||||
----------------------------------------------------------
|
||||
The following parameters were available to the step:
|
||||
***
|
||||
${stepParameters}
|
||||
***
|
||||
The error was:
|
||||
***
|
||||
${err}
|
||||
***
|
||||
Further information:
|
||||
* Documentation of step ${stepName}: .../${stepName}/
|
||||
* Pipeline documentation: https://...
|
||||
* GitHub repository for pipeline steps: https://...
|
||||
----------------------------------------------------------
|
||||
```
|
||||
## ${docGenParameters}
|
||||
|
||||
## Step configuration
|
||||
|
||||
none
|
||||
|
||||
## Side effects
|
||||
|
||||
none
|
||||
|
||||
## Exceptions
|
||||
|
||||
none
|
||||
|
@ -1,5 +1,6 @@
|
||||
import com.cloudbees.groovy.cps.NonCPS
|
||||
|
||||
import com.sap.piper.GenerateDocumentation
|
||||
import com.sap.piper.ConfigurationHelper
|
||||
|
||||
import groovy.text.SimpleTemplateEngine
|
||||
@ -10,14 +11,49 @@ import groovy.transform.Field
|
||||
@Field Set GENERAL_CONFIG_KEYS = []
|
||||
@Field Set STEP_CONFIG_KEYS = []
|
||||
@Field Set PARAMETER_KEYS = [
|
||||
/**
|
||||
* If set to true the following will be output to the console:
|
||||
* 1. Step beginning: `--- Begin library step: ${stepName}.groovy ---`
|
||||
* 2. Step end: `--- End library step: ${stepName}.groovy ---`
|
||||
* 3. Step errors:
|
||||
*
|
||||
* ```log
|
||||
* ----------------------------------------------------------
|
||||
* --- An error occurred in the library step: ${stepName}
|
||||
* ----------------------------------------------------------
|
||||
* The following parameters were available to the step:
|
||||
* ***
|
||||
* ${stepParameters}
|
||||
* ***
|
||||
* The error was:
|
||||
* ***
|
||||
* ${err}
|
||||
* ***
|
||||
* Further information:
|
||||
* * Documentation of step ${stepName}: .../${stepName}/
|
||||
* * Pipeline documentation: https://...
|
||||
* * GitHub repository for pipeline steps: https://...
|
||||
* ----------------------------------------------------------
|
||||
* ```
|
||||
* @possibleValues `true`, `false`
|
||||
*/
|
||||
'echoDetails',
|
||||
/** Defines the url of the library's documentation that will be used to generate the corresponding links to the step documentation.*/
|
||||
'libraryDocumentationUrl',
|
||||
/** Defines the url of the library's repository that will be used to generate the corresponding links to the step implementation.*/
|
||||
'libraryRepositoryUrl',
|
||||
/** Defines the name of the step executed that will be shown in the console output.*/
|
||||
'stepName',
|
||||
/** */
|
||||
'stepNameDoc',
|
||||
/** Defines the parameters from the step to be executed. The list of parameters is then shown in the console output.*/
|
||||
'stepParameters'
|
||||
]
|
||||
|
||||
/**
|
||||
* Used by other steps to make error analysis easier. Lists parameters and other data available to the step in which the error occurs.
|
||||
*/
|
||||
@GenerateDocumentation
|
||||
void call(Map parameters = [:], body) {
|
||||
// load default & individual configuration
|
||||
Map config = ConfigurationHelper.newInstance(this)
|
||||
|
Loading…
Reference in New Issue
Block a user