aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Rendina <rendinam@users.noreply.github.com>2017-08-18 14:03:53 -0400
committerGitHub <noreply@github.com>2017-08-18 14:03:53 -0400
commitd560830c8c0f38c3fe51dff3000e133a505d075a (patch)
tree637f41b043bbd6aad23f16a1171027e37e0cc788
parente85a7e714db8bc1b353848486935582825b1e311 (diff)
parentb596928792c998137d5f26ca6e20ed051c0fe1f7 (diff)
downloadbuild_control-d560830c8c0f38c3fe51dff3000e133a505d075a.tar.gz
Merge pull request #26 from rendinam/lib_cache
Use site cache for yaml library
-rw-r--r--jenkins/job-suite-generator.groovy15
1 files changed, 13 insertions, 2 deletions
diff --git a/jenkins/job-suite-generator.groovy b/jenkins/job-suite-generator.groovy
index 4d9b30d..1501b69 100644
--- a/jenkins/job-suite-generator.groovy
+++ b/jenkins/job-suite-generator.groovy
@@ -8,7 +8,12 @@
this.ldir = "libs"
// URL for the YAML support library used for accessing manifest files
-yaml_lib_url = "https://repo1.maven.org/maven2/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar"
+// Site file cache for components that would otherwise be downloaded for each
+// build. A symlink exists in the Jenkins user's home directory on the build
+// master which points to the actual storage location.
+site_file_cache_dir = "~/site-cache"
+yaml_lib_file = "snakeyaml-1.17.jar"
+yaml_lib_url_base = "https://repo1.maven.org/maven2/org/yaml/snakeyaml/1.17"
// DSL script path within the repository obtained for this job.
this.dsl_script = "jenkins/generator_DSL.groovy"
@@ -68,8 +73,14 @@ node("master") {
stage("Setup") {
sh "mkdir -p ${this.ldir}"
// Obtain libraries to facilitate job generation tasks.
+ // Attempt to copy from site cache first, if that fails, try to
+ // download from the internet.
dir ("libs") {
- sh "curl -O ${yaml_lib_url}"
+ def cp_status = sh(script: "cp ${site_file_cache_dir}/${yaml_lib_file} .",
+ returnStatus: true)
+ if (cp_status != 0) {
+ sh "curl -O ${yaml_lib_url_base}/${yaml_lib_file}"
+ }
}
// Copy files from the implicit checkout of the build_control directory
// (handled by the job that reads this pipeline script) into the actual