2019-03-29 14:12:28 +02:00
|
|
|
# ${docGenStepName}
|
2017-07-11 15:12:03 +02:00
|
|
|
|
2019-03-29 14:12:28 +02:00
|
|
|
## ${docGenDescription}
|
2017-07-11 15:12:03 +02:00
|
|
|
|
|
|
|
## Prerequisites
|
2018-11-06 14:50:09 +02:00
|
|
|
|
2017-07-11 15:12:03 +02:00
|
|
|
none
|
|
|
|
|
2019-04-04 10:50:46 +02:00
|
|
|
## ${docGenParameters}
|
|
|
|
|
|
|
|
## ${docGenConfiguration}
|
|
|
|
|
2019-05-24 15:44:31 +02:00
|
|
|
## ${docJenkinsPluginDependencies}
|
2019-05-24 15:41:49 +02:00
|
|
|
|
2017-07-11 15:12:03 +02:00
|
|
|
## Example
|
2018-11-06 14:50:09 +02:00
|
|
|
|
2017-07-11 15:12:03 +02:00
|
|
|
```groovy
|
|
|
|
handlePipelineStepErrors (stepName: 'executeHealthCheck', stepParameters: parameters) {
|
2020-03-05 11:19:02 +02:00
|
|
|
// The code you want to get controlled by the error handler goes right here into the closure
|
2017-07-11 15:12:03 +02:00
|
|
|
def url = new Utils().getMandatoryParameter(parameters, 'url', null)
|
|
|
|
def statusCode = curl(url)
|
|
|
|
if (statusCode != '200')
|
2019-04-04 10:50:46 +02:00
|
|
|
error "Health Check failed: \${statusCode}"
|
2017-07-11 15:12:03 +02:00
|
|
|
}
|
|
|
|
```
|
2019-04-03 13:16:38 +02:00
|
|
|
|
|
|
|
## Example console output
|
|
|
|
|
|
|
|
If `echoDetails` is set to true the following information will be output to the console:
|
|
|
|
|
2019-04-04 17:01:30 +02:00
|
|
|
1. Step beginning: `--- Begin library step: \${stepName}.groovy ---`
|
|
|
|
1. Step end: `--- End library step: \${stepName}.groovy ---`
|
2019-04-03 13:16:38 +02:00
|
|
|
1. Step errors:
|
|
|
|
|
|
|
|
```log
|
|
|
|
----------------------------------------------------------
|
2019-04-04 17:01:30 +02:00
|
|
|
--- An error occurred in the library step: \${stepName}
|
2019-04-03 13:16:38 +02:00
|
|
|
----------------------------------------------------------
|
|
|
|
The following parameters were available to the step:
|
|
|
|
***
|
2019-04-04 10:50:46 +02:00
|
|
|
\${stepParameters}
|
2019-04-03 13:16:38 +02:00
|
|
|
***
|
|
|
|
The error was:
|
|
|
|
***
|
2019-04-04 10:50:46 +02:00
|
|
|
\${err}
|
2019-04-03 13:16:38 +02:00
|
|
|
***
|
|
|
|
Further information:
|
2019-04-04 10:50:46 +02:00
|
|
|
* Documentation of step \${stepName}: .../\${stepName}/
|
2019-04-03 13:16:38 +02:00
|
|
|
* Pipeline documentation: https://...
|
|
|
|
* GitHub repository for pipeline steps: https://...
|
|
|
|
----------------------------------------------------------
|
|
|
|
```
|