Skip to content

Commit

Permalink
CASSANDRA-19504: Improve state management for Java versions in Jenkin…
Browse files Browse the repository at this point in the history
…sfile

patch by Bret McGuire; reviewed by Bret McGuire for CASSANDRA-19504
  • Loading branch information
absurdfarce committed Mar 29, 2024
1 parent 40a9a49 commit f836f15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ def initializeEnvironment() {
. ${JABBA_SHELL}
jabba which 1.8''', returnStdout: true).trim()

env.TEST_JAVA_HOME = sh(label: 'Get TEST_JAVA_HOME',script: '''#!/bin/bash -le
. ${JABBA_SHELL}
jabba which ${JABBA_VERSION}''', returnStdout: true).trim()
env.TEST_JAVA_VERSION = sh(label: 'Get TEST_JAVA_VERSION',script: '''#!/bin/bash -le
echo "${JABBA_VERSION##*.}"''', returnStdout: true).trim()

sh label: 'Download Apache CassandraⓇ or DataStax Enterprise',script: '''#!/bin/bash -le
. ${JABBA_SHELL}
jabba use 1.8
Expand Down Expand Up @@ -115,7 +109,12 @@ def buildDriver(jabbaVersion) {
}

def executeTests() {
sh label: 'Execute tests', script: '''#!/bin/bash -le
def testJavaHome = sh(label: 'Get TEST_JAVA_HOME',script: '''#!/bin/bash -le
. ${JABBA_SHELL}
jabba which ${JABBA_VERSION}''', returnStdout: true).trim()
def testJavaVersion = (JABBA_VERSION =~ /.*\.(\d+)/)[0][1]

def executeTestScript = '''#!/bin/bash -le
# Load CCM environment variables
set -o allexport
. ${HOME}/environment.txt
Expand All @@ -137,8 +136,8 @@ def executeTests() {
printenv | sort
mvn -B -V ${INTEGRATION_TESTS_FILTER_ARGUMENT} -T 1 verify \
-Ptest-jdk-${TEST_JAVA_VERSION} \
-DtestJavaHome=${TEST_JAVA_HOME} \
-Ptest-jdk-'''+testJavaVersion+''' \
-DtestJavaHome='''+testJavaHome+''' \
-DfailIfNoTests=false \
-Dmaven.test.failure.ignore=true \
-Dmaven.javadoc.skip=${SKIP_JAVADOCS} \
Expand All @@ -149,6 +148,8 @@ def executeTests() {
${ISOLATED_ITS_ARGUMENT} \
${PARALLELIZABLE_ITS_ARGUMENT}
'''
echo "Invoking Maven with parameters test-jdk-${testJavaVersion} and testJavaHome = ${testJavaHome}"
sh label: 'Execute tests', script: executeTestScript
}

def executeCodeCoverage() {
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ limitations under the License.]]></inlineHeader>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<jvm>${testing.jvm}/bin/java</jvm>
<systemPropertyVariables>
<logback.configurationFile>${project.basedir}/src/test/resources/logback-test.xml</logback.configurationFile>
</systemPropertyVariables>
Expand Down

0 comments on commit f836f15

Please sign in to comment.