[AMQ-9351] Add JDK version as a choice for build runs

This commit is contained in:
Matt Pavlovich 2023-10-20 16:27:08 -05:00
parent 89d0f2975d
commit 8e0f077fb0

18
Jenkinsfile vendored
View File

@ -30,7 +30,7 @@ pipeline {
tools { tools {
// ... tell Jenkins what java version, maven version or other tools are required ... // ... tell Jenkins what java version, maven version or other tools are required ...
maven 'maven_3_latest' maven 'maven_3_latest'
jdk 'jdk_17_latest' jdk params.jdkVersion
} }
options { options {
@ -43,6 +43,7 @@ pipeline {
parameters { parameters {
choice(name: 'nodeLabel', choices: ['ubuntu', 's390x']) choice(name: 'nodeLabel', choices: ['ubuntu', 's390x'])
choice(name: 'jdkVersion', choices: ['jdk_17_latest', 'jdk_21_latest'])
} }
stages { stages {
@ -93,15 +94,25 @@ pipeline {
} }
stage('Verify') { stage('Verify') {
tools {
jdk params.jdkVersion
}
steps { steps {
echo 'Running apache-rat:check' echo 'Running apache-rat:check'
sh 'java -version'
sh 'mvn -version'
sh 'mvn apache-rat:check' sh 'mvn apache-rat:check'
} }
} }
stage('Tests') { stage('Tests') {
tools {
jdk params.jdkVersion
}
steps { steps {
echo 'Running tests' echo 'Running tests'
sh 'java -version'
sh 'mvn -version'
// all tests is very very long (10 hours on Apache Jenkins) // all tests is very very long (10 hours on Apache Jenkins)
// sh 'mvn -B -e test -pl activemq-unit-tests -Dactivemq.tests=all' // sh 'mvn -B -e test -pl activemq-unit-tests -Dactivemq.tests=all'
sh 'mvn -B -e -fae test -Dsurefire.rerunFailingTestsCount=3' sh 'mvn -B -e -fae test -Dsurefire.rerunFailingTestsCount=3'
@ -115,6 +126,9 @@ pipeline {
} }
stage('Deploy') { stage('Deploy') {
tools {
jdk params.jdkVersion
}
when { when {
expression { expression {
env.BRANCH_NAME ==~ /(activemq-5.18.x|activemq-5.17.x|main)/ env.BRANCH_NAME ==~ /(activemq-5.18.x|activemq-5.17.x|main)/
@ -122,6 +136,8 @@ pipeline {
} }
steps { steps {
echo 'Deploying' echo 'Deploying'
sh 'java -version'
sh 'mvn -version'
sh 'mvn -B -e deploy -Pdeploy -DskipTests' sh 'mvn -B -e deploy -Pdeploy -DskipTests'
} }
} }