Skip to content

Commit 778fe59

Browse files
authored
ci: GraalVM CI uses existing Truststore if configured (#1914)
* chore: Enable SSL debug logs for GraalVM image * chore: Pass SSL debug config to the native image * chore: Unset the tool options * chore: Set the native image truststore directly * chore: Test runtime args for graalvm * chore: Use the execution-id * chore: latest runs * chore: Add comments to explain
1 parent 0f92593 commit 778fe59

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

.kokoro/build.sh

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,28 @@ graalvm)
8080
# Run Unit and Integration Tests with Native Image
8181
bash .kokoro/populate-secrets.sh
8282
export GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_GFILE_DIR}/secret_manager/java-it-service-account"
83-
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Pnative-test -Pslf4j2x test -pl 'oauth2_http'
83+
84+
# GraalVM Native Image ignores JAVA_TOOL_OPTIONS at runtime. If the CI environment
85+
# injects a custom truststore (e.g., for a proxy) via JAVA_TOOL_OPTIONS, we need to
86+
# extract it and pass it explicitly to the native executable.
87+
TRUST_STORE=""
88+
if [[ "${JAVA_TOOL_OPTIONS}" =~ -Djavax.net.ssl.trustStore=([^ ]+) ]]; then
89+
TRUST_STORE="${BASH_REMATCH[1]}"
90+
fi
91+
92+
# We use 'package' instead of 'test' to build the native image without automatically
93+
# running it via the Maven plugin. This allows us to run it manually with the
94+
# extracted truststore argument in the next step, avoiding complex Maven XML overrides.
95+
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Pnative-test -Pslf4j2x package -pl 'oauth2_http'
96+
97+
# Run the native tests manually with the truststore
98+
CMD="./oauth2_http/target/native-tests --xml-output-dir ./oauth2_http/target/native-test-reports"
99+
if [ -n "$TRUST_STORE" ]; then
100+
CMD="$CMD -Djavax.net.ssl.trustStore=$TRUST_STORE"
101+
fi
102+
103+
echo "Executing: $CMD"
104+
$CMD
84105
RETURN_CODE=$?
85106
;;
86107
samples)

0 commit comments

Comments
 (0)