From 8a000a502ce9208dbe9a810b18268a805c8cb5fa Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 14 Sep 2018 16:14:03 -0400 Subject: [PATCH] Add script to cache dependencies (#33726) 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..906b2dd642074 --- /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 805bb346adc84..3ad81463b1ae4 100644 --- a/build.gradle +++ b/build.gradle @@ -667,3 +667,11 @@ if (System.properties.get("build.compare") != null) { } } } + +allprojects { + task resolveAllDependencies { + doLast { + configurations.findAll { it.isCanBeResolved() }.each { it.resolve() } + } + } +}