This is an automated email from the ASF dual-hosted git repository.

absurdfarce pushed a commit to branch 4.x
in repository https://gitbox.apache.org/repos/asf/cassandra-java-driver.git


The following commit(s) were added to refs/heads/4.x by this push:
     new 98e25040f CASSANDRA-19504: Improve state management for Java versions 
in Jenkinsfile
98e25040f is described below

commit 98e25040f5e69db1092ccafb6665d8e92779cc46
Author: absurdfarce <[email protected]>
AuthorDate: Thu Mar 28 15:37:22 2024 -0500

    CASSANDRA-19504: Improve state management for Java versions in Jenkinsfile
    
    patch by Bret McGuire; reviewed by Bret McGuire for CASSANDRA-19504
---
 Jenkinsfile | 19 ++++++++++---------
 pom.xml     |  1 +
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index c82477696..8d2b74c5b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -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
@@ -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
@@ -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} \
@@ -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() {
diff --git a/pom.xml b/pom.xml
index 221e1f69a..7decc9663 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to