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.
This commit is contained in:
Jason Tedor 2018-09-14 16:14:03 -04:00 committed by GitHub
parent 9706584836
commit 92a48fa6b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

19
.ci/packer_cache.sh Executable file
View File

@ -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

View File

@ -628,3 +628,11 @@ if (System.properties.get("build.compare") != null) {
}
}
}
allprojects {
task resolveAllDependencies {
doLast {
configurations.findAll { it.isCanBeResolved() }.each { it.resolve() }
}
}
}