Skip to content

Commit 92a48fa

Browse files
authored
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.
1 parent 9706584 commit 92a48fa

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

.ci/packer_cache.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
SCRIPT="$0"
4+
5+
# SCRIPT might be an arbitrarily deep series of symbolic links; loop until we
6+
# have the concrete path
7+
while [ -h "$SCRIPT" ] ; do
8+
ls=$(ls -ld "$SCRIPT")
9+
# Drop everything prior to ->
10+
link=$(expr "$ls" : '.*-> \(.*\)$')
11+
if expr "$link" : '/.*' > /dev/null; then
12+
SCRIPT="$link"
13+
else
14+
SCRIPT=$(dirname "$SCRIPT")/"$link"
15+
fi
16+
done
17+
18+
source $(dirname "${SCRIPT}")/java-versions.properties
19+
JAVA_HOME="${HOME}"/.java/${ES_BUILD_JAVA} ./gradlew resolveAllDependencies --parallel

build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,3 +628,11 @@ if (System.properties.get("build.compare") != null) {
628628
}
629629
}
630630
}
631+
632+
allprojects {
633+
task resolveAllDependencies {
634+
doLast {
635+
configurations.findAll { it.isCanBeResolved() }.each { it.resolve() }
636+
}
637+
}
638+
}

0 commit comments

Comments
 (0)