1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

Prevent pointing to pipelineExecute in case of an failure inside foreign pipeline

In case there is an error in another pipeline step inside a foreign pipeline we got
nevertheless an error explaining there is an issue inside the pipeline load step.
This commit is contained in:
Marcus Holl 2017-12-01 17:00:30 +01:00
parent 15a7e8e3f8
commit 36837ad3b8

View File

@ -7,22 +7,26 @@ import com.sap.piper.Utils
*/
def call(Map parameters = [:]) {
handlePipelineStepErrors (stepName: 'pipelineExecute', stepParameters: parameters) {
node() {
def utils = new Utils()
def path
// The coordinates of the pipeline script
def repo = utils.getMandatoryParameter(parameters, 'repoUrl', null)
def branch = utils.getMandatoryParameter(parameters, 'branch', 'master')
def path = utils.getMandatoryParameter(parameters, 'path', 'Jenkinsfile')
handlePipelineStepErrors (stepName: 'pipelineExecute', stepParameters: parameters) {
// In case access to the repository containing the pipeline
// script is restricted the credentialsId of the credentials used for
// accessing the repository needs to be provided below. The corresponding
// credentials needs to be configured in Jenkins accordingly.
def credentialsId = utils.getMandatoryParameter(parameters, 'credentialsId', '')
def utils = new Utils()
// The coordinates of the pipeline script
def repo = utils.getMandatoryParameter(parameters, 'repoUrl', null)
def branch = utils.getMandatoryParameter(parameters, 'branch', 'master')
path = utils.getMandatoryParameter(parameters, 'path', 'Jenkinsfile')
// In case access to the repository containing the pipeline
// script is restricted the credentialsId of the credentials used for
// accessing the repository needs to be provided below. The corresponding
// credentials needs to be configured in Jenkins accordingly.
def credentialsId = utils.getMandatoryParameter(parameters, 'credentialsId', '')
node() {
deleteDir()
checkout([$class: 'GitSCM', branches: [[name: branch]],
@ -36,7 +40,7 @@ def call(Map parameters = [:]) {
]]
])
load path
}
load path
}
}