1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/vars/pipelineExecute.groovy
Marcus Holl b7468a7ae4 Step name is not a string literal anymore
Having the step name always the same like the file name, which is in turn the class name is
redundant.
2018-11-29 09:54:05 +01:00

53 lines
1.7 KiB
Groovy

import com.sap.piper.Utils
import groovy.transform.Field
@Field STEP_NAME = getClass().getName()
/**
* pipelineExecute
* Load and executes a pipeline from another git repository.
*
*/
void call(Map parameters = [:]) {
node() {
def path
handlePipelineStepErrors (stepName: 'pipelineExecute', stepParameters: parameters) {
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', '')
deleteDir()
checkout([$class: 'GitSCM', branches: [[name: branch]],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'SparseCheckoutPaths',
sparseCheckoutPaths: [[path: path]]
]],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: credentialsId,
url: repo
]]
])
}
load path
}
}