Skip to content
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

OAK-10613: Set Java version in Jenkinsfile to 17 (for SonarCloud) #1274

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Jenkinsfile
Expand Up @@ -43,7 +43,7 @@ def buildModule(moduleSpec) {
}
stage(moduleSpec) {
node(label: 'ubuntu') {
def JAVA_JDK_11=tool name: 'jdk_11_latest', type: 'hudson.model.JDK'
def JAVA_JDK_17=tool name: 'jdk_17_latest', type: 'hudson.model.JDK'
def MAVEN_3_LATEST=tool name: 'maven_3_latest', type: 'hudson.tasks.Maven$MavenInstallation'
def MAVEN_CMD = "mvn --batch-mode -Dmaven.repo.local=${env.HOME}/maven-repositories/${env.EXECUTOR_NUMBER}"
def MONGODB_SUFFIX = sh(script: 'openssl rand -hex 4', returnStdout: true).trim()
Expand All @@ -56,7 +56,7 @@ def buildModule(moduleSpec) {
'''
timeout(70) {
checkout scm
withEnv(["Path+JDK=$JAVA_JDK_11/bin","Path+MAVEN=$MAVEN_3_LATEST/bin","JAVA_HOME=$JAVA_JDK_11","MAVEN_OPTS=-Xmx1536M"]) {
withEnv(["Path+JDK=$JAVA_JDK_17/bin","Path+MAVEN=$MAVEN_3_LATEST/bin","JAVA_HOME=$JAVA_JDK_17","MAVEN_OPTS=-Xmx1536M"]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually you want to separate checking with SonarCloud from the actual build. Look at https://github.com/apache/sling-tooling-jenkins/blob/fa79d93ce00c6f52fafaad348a04d2c0757460ed/vars/slingOsgiBundleBuild.groovy#L234C15-L234C15 or https://github.com/apache/jackrabbit-filevault-jenkins-lib/blob/7b2e2f0fce955141c1bc62ebb4a1ba36f6ba7c62/vars/vaultStageBuild.groovy#L69. That way different JDKs can be used for those.
I think building and testing with just JDK17 is probably not enough (if we state that we support building with Java11+, https://github.com/apache/jackrabbit-oak?tab=readme-ov-file#getting-started)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually SonarQube is executed by GitHub Actions not ASF Jenkins.

sh '''
echo "MAVEN_OPTS is ${MAVEN_OPTS}"
'''
Expand Down