From 038e21ff0ac0d8a88703158552d7611d37719289 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 14 Sep 2018 14:32:18 -0400 Subject: [PATCH 1/3] Add script to cache dependencies With the introduction of immutable workers into our CI, we now have a problem where we would have to download dependencies on every single build. To this end our infrastructure team has introduced the possibility to download dependencies one time and then bake these into the base immutable worker image. For this, we introduce our version of this special script which runs a task that downloads all dependencies of all configurations. With this script, our infrastructure team will be rebuilding these images on an at-least daily basis. This helps us avoid having to download the dependencies for every single build. --- .ci/packer_cache.sh | 19 +++++++++++++++++++ build.gradle | 8 ++++++++ 2 files changed, 27 insertions(+) create mode 100755 .ci/packer_cache.sh diff --git a/.ci/packer_cache.sh b/.ci/packer_cache.sh new file mode 100755 index 0000000000000..de101df349c4a --- /dev/null +++ b/.ci/packer_cache.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +SCRIPT="$0" + +# SCRIPT might be an arbitrarily deep series of symbolic links; loop until we +# have the concrete path +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + # Drop everything prior to -> + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +source $(dirname "${SCRIPT}")/java-versions.properties +JAVA_HOME="${HOME}"/.java/${ES_BUILD_JAVA} ./gradlew resolveAllDependencies --parallel diff --git a/build.gradle b/build.gradle index a0c00db10dca2..3d606049b1fc0 100644 --- a/build.gradle +++ b/build.gradle @@ -628,3 +628,11 @@ if (System.properties.get("build.compare") != null) { } } } + +allprojects { + task resolveAllDependencies { + doLast { + configurations.all { if (it.isCanBeResolved()) it.resolve() } + } + } +} From 5e81556af645d137305758eddf36fcfb51deb104 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 14 Sep 2018 14:36:29 -0400 Subject: [PATCH 2/3] No backticks --- .ci/packer_cache.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/packer_cache.sh b/.ci/packer_cache.sh index de101df349c4a..906b2dd642074 100755 --- a/.ci/packer_cache.sh +++ b/.ci/packer_cache.sh @@ -5,13 +5,13 @@ SCRIPT="$0" # SCRIPT might be an arbitrarily deep series of symbolic links; loop until we # have the concrete path while [ -h "$SCRIPT" ] ; do - ls=`ls -ld "$SCRIPT"` + ls=$(ls -ld "$SCRIPT") # Drop everything prior to -> - link=`expr "$ls" : '.*-> \(.*\)$'` + link=$(expr "$ls" : '.*-> \(.*\)$') if expr "$link" : '/.*' > /dev/null; then SCRIPT="$link" else - SCRIPT=`dirname "$SCRIPT"`/"$link" + SCRIPT=$(dirname "$SCRIPT")/"$link" fi done From 0c3b4595467a9377eedd393876b4db9874752c15 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 14 Sep 2018 14:42:35 -0400 Subject: [PATCH 3/3] Cleanup task def --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 3d606049b1fc0..a2b79d31bad7e 100644 --- a/build.gradle +++ b/build.gradle @@ -632,7 +632,7 @@ if (System.properties.get("build.compare") != null) { allprojects { task resolveAllDependencies { doLast { - configurations.all { if (it.isCanBeResolved()) it.resolve() } + configurations.findAll { it.isCanBeResolved() }.each { it.resolve() } } } }