elasticsearch/.buildkite/scripts/gradle-configuration-cache-validation.sh
Rene Groeschke ba52a225dd
[Build] Make checkPart4 configuration cache compatible (#117250)
This makes checkPart4 tasks in general configuration cache compliant. 

We do not enable it by default in our pipelines yet. That will
eventually be done in separate PRs. To track any regressions we cover
the checkPart4 task in the weekly gradle cache validation build job
2024-12-15 20:49:25 +11:00

26 lines
784 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
# This is a workaround for https://github.com/gradle/gradle/issues/28159
.ci/scripts/run-gradle.sh --no-daemon $@
.ci/scripts/run-gradle.sh --configuration-cache -Dorg.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks=build/*.tar.bz2 $@
# Create a temporary file
tmpOutputFile=$(mktemp)
trap "rm $tmpOutputFile" EXIT
echo "2nd run"
.ci/scripts/run-gradle.sh --configuration-cache -Dorg.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks=build/*.tar.bz2 $@ | tee $tmpOutputFile
# Check if the command was successful
if grep -q "Configuration cache entry reused." $tmpOutputFile; then
echo "Gradle configuration cache reused"
exit 0
else
echo "Failed to reuse Gradle configuration cache."
exit 1
fi