Try to use the REPO_ROOT environment variable

This commit is contained in:
Dan Hawkins 2019-02-11 18:43:08 +00:00
commit eb07ef6dc0

View file

@ -19,12 +19,8 @@ def SparseCheckoutPaths sparsecheckoutconfig(ArrayList<String> paths) {
return new SparseCheckoutPaths(sparsecheckoutpaths) return new SparseCheckoutPaths(sparsecheckoutpaths)
} }
def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList<String> sparseitemlist = new ArrayList<String>()) { def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = env.REPO_ROOT.trim(), int cloneDepth = 1, boolean shallowClone = true, ArrayList<String> sparseitemlist = new ArrayList<String>()) {
reporootenv = env.REPO_ROOT if (repoRoot == "") {
if (reporootenv != null && 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" 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([ checkout([
@ -39,7 +35,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo
extensions: [ extensions: [
[$class: 'GitLFSPull'], [$class: 'GitLFSPull'],
[$class: 'CleanBeforeCheckout'], [$class: 'CleanBeforeCheckout'],
[$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: repoRoot, shallow: shallowClone, timeout: 120],
[$class: 'CheckoutOption', timeout: 120], [$class: 'CheckoutOption', timeout: 120],
[$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir], [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir],
sparsecheckoutconfig(sparseitemlist) sparsecheckoutconfig(sparseitemlist)