Check for undefined REPO_ROOT environment variable

This commit is contained in:
Dan Hawkins 2018-02-18 18:16:20 +00:00
commit 9d32414fca

View file

@ -7,6 +7,13 @@ String getGitInfo(String workingSetRootPath) {
}
def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) {
reporootenv = env.REPO_ROOT
if (reporootenv != mull && repoRoot != "") {
reporootpath = "${reporootenv.trim()}/${repoRoot}"
} else {
reporootpath = ""
echo "To improve Git performance: Define the REPO_ROOT enviroment to a path where a cache of git repositories can be placed on this slave"
}
checkout([
$class: 'GitSCM',
userRemoteConfigs: [
@ -18,7 +25,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'CleanBeforeCheckout'],
[$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: "${REPO_ROOT}/${repoRoot}", shallow: shallowClone, timeout: 120],
[$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120],
[$class: 'CheckoutOption', timeout: 60],
[$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir]
],