Try to speed up release repo check out

This commit is contained in:
Dan Hawkins 2019-02-11 19:07:43 +00:00
commit 9f47550d0e
3 changed files with 8 additions and 7 deletions

View file

@ -32,7 +32,7 @@ def getmetafolderscript() {
}
// Start up boilderplate
def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) {
def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, String repoRootSuffix = "", autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) {
echo "Starting...."
autobuildroot = autobuildpath
@ -48,7 +48,7 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA
meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString())
def rr = load("${commonscripts()}/release/registerrepo.groovy")
rr.registerrepo(meta, releaserepo)
rr.registerrepo(meta, releaserepo, repoRootSuffix)
def ch = load("${commonscripts()}/configuration/configuration.groovy")
ch.registerPipelineScriptConfiguration(meta)

View file

@ -2,9 +2,9 @@
vc = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
// Prove the existence of the release repo - otherwise there is a large wait to cycle the build to correct the meta data
def registerrepo(meta, String releaserepo) {
def registerrepo(meta, String releaserepo, String repoRootSuffix = "") {
if (releaserepo?.trim()) {
vc.gitCheckout(releaserepo, "origin/master", "tmp/releaserepo")
vc.gitCheckout(releaserepo, "origin/master", "tmp/releaserepo", repoRootSuffix)
}
meta.releaseinfo.set(releaserepo)
}

View file

@ -19,10 +19,11 @@ def SparseCheckoutPaths sparsecheckoutconfig(ArrayList<String> paths) {
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 repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList<String> sparseitemlist = new ArrayList<String>()) {
reporootenv = env.REPO_ROOT
if (reporootenv != null && repoRoot != "") {
reporootpath = "${reporootenv.trim()}/${repoRoot}"
if (reporootenv != null && repoRootSuffix != "") {
reporootpath = "${reporootenv.trim()}/${repoRootSuffix}"
echo "Using release repo: ${reporootpath}"
} 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"