-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: using JDK 11+ to compile and JDK 8 to run junit (8) #1870
Changes from all commits
ba89167
a18055c
37f7eb2
100f41e
e42a572
ac77054
52a1214
ec67faf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,17 @@ cd ${scriptDir}/.. | |
# include common functions | ||
source ${scriptDir}/common.sh | ||
|
||
function setJava() { | ||
export JAVA_HOME=$1 | ||
export PATH=${JAVA_HOME}/bin:$PATH | ||
} | ||
|
||
# units-java8 uses both JDK 11 and JDK 8. GraalVM dependencies require JDK 11 to | ||
# compile the classes touching GraalVM classes. | ||
if [ ! -z "${JAVA11_HOME}" ]; then | ||
setJava "${JAVA11_HOME}" | ||
Comment on lines
+33
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JAVA11_HOME is now available in the container image for Kokoro: |
||
fi | ||
|
||
# Print out Maven & Java version | ||
mvn -version | ||
echo ${JOB_TYPE} | ||
|
@@ -42,12 +53,19 @@ if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTI | |
export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) | ||
fi | ||
|
||
# units-java8 uses both JDK 11 and JDK 8. We ensure the generated class files | ||
# are compatible with Java 8 when running tests. | ||
if [ ! -z "${JAVA8_HOME}" ]; then | ||
setJava "${JAVA8_HOME}" | ||
Comment on lines
+58
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JAVA8_HOME is now available in the container image for Kokoro: |
||
mvn -version | ||
fi | ||
|
||
RETURN_CODE=0 | ||
set +e | ||
|
||
case ${JOB_TYPE} in | ||
test) | ||
mvn test -B \ | ||
mvn test -B -V \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do we need the version of mvn for - does it tie to native image compilation in some way? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This clarifies which versions of JDK it's running. We're running JDK 11 to compile and JDK 8 to run tests. (It's nice-to-have) |
||
-Dclirr.skip=true \ | ||
-Denforcer.skip=true \ | ||
-Djava.net.preferIPv4Stack=true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,4 +224,17 @@ | |
</plugins> | ||
</reporting> | ||
|
||
<profiles> | ||
<profile> | ||
<!-- JDK 9+ has the "release" option to ensure the generated bytecode is | ||
compatible with Java 8. --> | ||
<id>compiler-release-8</id> | ||
Comment on lines
+228
to
+231
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This profile may be appropriate to be defined in the google-cloud-shared-config (the parent pom of this file). The google-cloud-shared-config defines compiler option:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added todo: googleapis/java-shared-config#477 |
||
<activation> | ||
<jdk>[9,]</jdk> | ||
</activation> | ||
<properties> | ||
<maven.compiler.release>8</maven.compiler.release> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
</project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this impact any of the existing test runs against java8?
units-java8
job should cover the unit tests, but on fusion, I can seejava8-samples
as another job.cc @thiagotnunes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Kokoro builds, I have modified java8 container to have JAVA11_HOME environment variable in googleapis/testing-infra-docker#211.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@suztomo We specify the docker image version for java8-samples here: https://github.com/googleapis/java-spanner/blob/main/.kokoro/nightly/java8-samples.cfg#L6
I think this will be alright, but double checking if we set the correct ENV variables in this container as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thiagotnunes Thank you for the info. Yes, that line
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
matches the container image URL I have modified. It hasJAVA8_HOME
andJAVA11_HOME
now. (I added the docker command invocation to my comment above)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the info LGTM