-
Notifications
You must be signed in to change notification settings - Fork 891
CASSJAVA-135 Update the build to use Java17 rather than Java8 #2096
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
01f1795
11e47da
182a8bf
495e68a
df1ec90
7a438b6
1c6f90d
c4ce2b3
0569441
517a576
569d59b
d696fcd
2e35151
b70bd2f
0cec826
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 |
|---|---|---|
|
|
@@ -31,28 +31,24 @@ def initializeEnvironment() { | |
| env.PATH = "${env.MAVEN_HOME}/bin:${env.PATH}" | ||
|
|
||
| /* | ||
| * As of JAVA-3042 JAVA_HOME is always set to JDK8 and this is currently necessary for mvn compile and DSE Search/Graph. | ||
| * To facilitate testing with JDK11/17 we feed the appropriate JAVA_HOME into the maven build via commandline. | ||
| * | ||
| * Maven command-line flags: | ||
| * - -DtestJavaHome=/path/to/java/home: overrides JAVA_HOME for surefire/failsafe tests, defaults to environment JAVA_HOME. | ||
| * - -Ptest-jdk-N: enables profile for running tests with a specific JDK version (substitute N for 8/11/17). | ||
| * | ||
| * Note test-jdk-N is also automatically loaded based off JAVA_HOME SDK version so testing with an older SDK is not supported. | ||
| * JAVA_HOME is always set to the specified runtime JDK (i.e. whatever is in JABBA_VERSION). This covers all Maven | ||
| * invocations. Actual tests run by Maven's surefire/failsafe plugin will be managed via test testJavaHome param. | ||
| * | ||
| * Environment variables: | ||
| * - JAVA_HOME: Path to JDK used for mvn (all steps except surefire/failsafe), Cassandra, DSE. | ||
| * - JAVA8_HOME: Path to JDK8 used for Cassandra/DSE if ccm determines JAVA_HOME is not compatible with the chosen backend. | ||
| * - TEST_JAVA_HOME: PATH to JDK used for surefire/failsafe testing. | ||
| * - TEST_JAVA_VERSION: TEST_JAVA_HOME SDK version number [8/11/17], used to configure test-jdk-N profile in maven (see above) | ||
| * - JAVA_HOME: Path to JDK used for mvn. ccm may use this if applicable, otherwise it falls back to JAVA8_HOME and JAVA11_HOME | ||
| * for older Cassandra/DSE/HCD instances. | ||
| * - JAVA8_HOME: Path to JDK8 used for Cassandra/DSE if ccm determines JAVA_HOME is not compatible with the chosen backend | ||
| * - JAVA11_HOME: Similar to JAVA8_HOME for Java11 | ||
| */ | ||
|
|
||
| env.JAVA_HOME = sh(label: 'Get JAVA_HOME',script: '''#!/bin/bash -le | ||
| . ${JABBA_SHELL} | ||
| jabba which ${JABBA_VERSION}''', returnStdout: true).trim() | ||
| env.JAVA8_HOME = sh(label: 'Get JAVA8_HOME',script: '''#!/bin/bash -le | ||
| env.JAVA8_HOME = sh(label: 'Get JAVA8_HOME (in case ccm needs it)',script: '''#!/bin/bash -le | ||
| . ${JABBA_SHELL} | ||
| jabba which 1.8''', returnStdout: true).trim() | ||
| env.JAVA11_HOME = sh(label: 'Get JAVA11_HOME (in case ccm needs it)',script: '''#!/bin/bash -le | ||
| . ${JABBA_SHELL} | ||
| jabba which openjdk@11''', returnStdout: true).trim() | ||
|
|
||
| sh label: 'Download Apache CassandraⓇ, DataStax Enterprise or DataStax HCD ',script: '''#!/bin/bash -le | ||
| . ${JABBA_SHELL} | ||
|
|
@@ -88,32 +84,31 @@ ENVIRONMENT_EOF | |
| ''' | ||
| } | ||
|
|
||
| sh label: 'Display Java and environment information',script: '''#!/bin/bash -le | ||
| sh label: 'Display Java and environment information for Maven',script: '''#!/bin/bash -le | ||
| # Load CCM environment variables | ||
| set -o allexport | ||
| . ${HOME}/environment.txt | ||
| set +o allexport | ||
|
|
||
| . ${JABBA_SHELL} | ||
| jabba use 1.8 | ||
| jabba use ${JABBA_VERSION} | ||
|
|
||
| java -version | ||
| mvn -v | ||
| printenv | sort | ||
| ''' | ||
| } | ||
|
|
||
| def buildDriver(jabbaVersion) { | ||
| def buildDriverScript = '''#!/bin/bash -le | ||
| def buildDriver() { | ||
| sh label: 'Build driver', script: '''#!/bin/bash -le | ||
|
|
||
| . ${JABBA_SHELL} | ||
| jabba use '''+jabbaVersion+''' | ||
| jabba use ${BUILD_JAVA_VERSION} | ||
|
|
||
| echo "Building with Java version '''+jabbaVersion+'''" | ||
| echo "Building with Java version ${BUILD_JAVA_VERSION}" | ||
|
|
||
| mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true | ||
| ''' | ||
| sh label: 'Build driver', script: buildDriverScript | ||
| } | ||
|
|
||
| def executeTests() { | ||
|
|
@@ -129,13 +124,7 @@ def executeTests() { | |
| set +o allexport | ||
|
|
||
| . ${JABBA_SHELL} | ||
| jabba use 1.8 | ||
|
|
||
| if [ "${JABBA_VERSION}" != "1.8" ]; then | ||
| SKIP_JAVADOCS=true | ||
| else | ||
| SKIP_JAVADOCS=false | ||
| fi | ||
| jabba use ${BUILD_JAVA_VERSION} | ||
|
Contributor
Author
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. We'll run Maven with the fixed Java version even though individual tests will be run via a (perhaps different) Java version passed in via the "testJavaHome" param. |
||
|
|
||
| INTEGRATION_TESTS_FILTER_ARGUMENT="" | ||
| if [ ! -z "${INTEGRATION_TESTS_FILTER}" ]; then | ||
|
|
@@ -144,14 +133,12 @@ def executeTests() { | |
| printenv | sort | ||
|
|
||
| mvn -B -V ${INTEGRATION_TESTS_FILTER_ARGUMENT} -T 1 verify \ | ||
| -Ptest-jdk-'''+testJavaVersion+''' \ | ||
| -DtestJavaHome='''+testJavaHome+''' \ | ||
| -DfailIfNoTests=false \ | ||
| -Dmaven.test.failure.ignore=true \ | ||
| -Dmaven.javadoc.skip=${SKIP_JAVADOCS} \ | ||
| -Dmaven.javadoc.skip=true \ | ||
| -Dccm.version=${CCM_CASSANDRA_VERSION} \ | ||
| -Dccm.distribution=${CCM_SERVER_TYPE:cassandra} \ | ||
| -Dproxy.path=${HOME}/proxy \ | ||
| ${SERIAL_ITS_ARGUMENT} \ | ||
| ${ISOLATED_ITS_ARGUMENT} \ | ||
| ${PARALLELIZABLE_ITS_ARGUMENT} | ||
|
|
@@ -329,10 +316,8 @@ pipeline { | |
| choice( | ||
| name: 'ADHOC_BUILD_AND_EXECUTE_TESTS_JABBA_VERSION', | ||
| choices: [ | ||
| '1.8', // Oracle JDK version 1.8 (current default) | ||
| 'openjdk@1.11', // OpenJDK version 11 | ||
| 'openjdk@1.17', // OpenJDK version 17 | ||
| 'openjdk@1.21' // OpenJDK version 21 | ||
| 'openjdk@21' // OpenJDK version 21 | ||
| ], | ||
| description: '''JDK version to use for <b>TESTING</b> when running adhoc <b>BUILD-AND-EXECUTE-TESTS</b> builds. <i>All builds will use JDK8 for building the driver</i> | ||
| <table style="width:100%"> | ||
|
|
@@ -342,20 +327,12 @@ pipeline { | |
| <th align="left">Choice</th> | ||
| <th align="left">Description</th> | ||
| </tr> | ||
| <tr> | ||
| <td><strong>1.8</strong></td> | ||
| <td>Oracle JDK version 1.8 (<i>Used for compiling regardless of choice</i>)</td> | ||
| </tr> | ||
| <tr> | ||
| <td><strong>openjdk@1.11</strong></td> | ||
| <td>OpenJDK version 11</td> | ||
| </tr> | ||
| <tr> | ||
| <td><strong>openjdk@1.17</strong></td> | ||
| <td>OpenJDK version 17</td> | ||
| </tr> | ||
| <tr> | ||
| <td><strong>openjdk@1.21</strong></td> | ||
| <td><strong>openjdk@21</strong></td> | ||
| <td>OpenJDK version 21</td> | ||
| </tr> | ||
| </table>''') | ||
|
|
@@ -394,16 +371,16 @@ pipeline { | |
| // schedules only run against release branches (i.e. 3.x, 4.x, 4.5.x, etc.) | ||
| parameterizedCron(branchPatternCron().matcher(env.BRANCH_NAME).matches() ? """ | ||
| # Every weekend (Saturday, Sunday) around 2:00 AM | ||
| H 2 * * 0 %CI_SCHEDULE=WEEKENDS;CI_SCHEDULE_SERVER_VERSIONS=4.0 4.1 5.0 dse-4.8.16 dse-5.0.15 dse-5.1.35 dse-6.0.18 dse-6.7.17;CI_SCHEDULE_JABBA_VERSION=1.8 | ||
| H 2 * * 0 %CI_SCHEDULE=WEEKENDS;CI_SCHEDULE_SERVER_VERSIONS=4.0 4.1 5.0 dse-4.8.16 dse-5.0.15 dse-5.1.35 dse-6.0.18 dse-6.7.17;CI_SCHEDULE_JABBA_VERSION=openjdk@1.17 | ||
| # Every weeknight (Monday - Friday) around 12:00 PM noon | ||
| H 12 * * 1-5 %CI_SCHEDULE=WEEKNIGHTS;CI_SCHEDULE_SERVER_VERSIONS=4.1 5.0 dse-6.8.30 dse-6.9.0 hcd-1.0.0;CI_SCHEDULE_JABBA_VERSION=openjdk@1.11 | ||
| H 12 * * 1-5 %CI_SCHEDULE=WEEKNIGHTS;CI_SCHEDULE_SERVER_VERSIONS=4.1 5.0 dse-6.8.30 dse-6.9.0 hcd-1.0.0;CI_SCHEDULE_JABBA_VERSION=openjdk@1.17 | ||
| """ : "") | ||
| } | ||
|
|
||
| environment { | ||
| OS_VERSION = 'ubuntu/focal64/java-driver' | ||
| JABBA_SHELL = '/usr/lib/jabba/jabba.sh' | ||
| BUILD_JAVA_VERSION = "openjdk@1.17" | ||
|
Contributor
Author
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. A significant simplification of what we had here. We define a single Java version used to build (and drive testing of) the driver here and all invocations elsewhere reference this. We were doing something functionally equivalent by passing the Java version for building the driver in as a param... this just simplifies everything in one place. |
||
| CCM_ENVIRONMENT_SHELL = '/usr/local/bin/ccm_environment.sh' | ||
| SERIAL_ITS_ARGUMENT = "-DskipSerialITs=${params.SKIP_SERIAL_ITS}" | ||
| ISOLATED_ITS_ARGUMENT = "-DskipIsolatedITs=${params.SKIP_ISOLATED_ITS}" | ||
|
|
@@ -439,10 +416,8 @@ pipeline { | |
| } | ||
| axis { | ||
| name 'JABBA_VERSION' | ||
| values '1.8', // jdk8 | ||
| 'openjdk@1.11', // jdk11 | ||
| 'openjdk@1.17', // jdk17 | ||
| 'openjdk@1.21' // jdk21 | ||
| values 'openjdk@1.17', // jdk17 | ||
| 'openjdk@21' // jdk21 | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -468,7 +443,7 @@ pipeline { | |
| } | ||
| stage('Build-Driver') { | ||
| steps { | ||
| buildDriver('1.8') | ||
| buildDriver() | ||
| } | ||
| } | ||
| stage('Execute-Tests') { | ||
|
|
@@ -583,7 +558,7 @@ pipeline { | |
| } | ||
| stage('Build-Driver') { | ||
| steps { | ||
| buildDriver('1.8') | ||
| buildDriver() | ||
| } | ||
| } | ||
| stage('Execute-Tests') { | ||
|
|
@@ -611,7 +586,7 @@ pipeline { | |
| when { | ||
| allOf { | ||
| environment name: 'SERVER_VERSION', value: '4.0' | ||
| environment name: 'JABBA_VERSION', value: '1.8' | ||
| environment name: 'JABBA_VERSION', value: 'openjdk@1.17' | ||
| } | ||
| } | ||
| steps { | ||
|
|
||
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.
Adding Java11 for sake of completeness. I believe at some point we lose support for Java8 on some Cassandra servers so really we're just trying to get out in front of things here.