Skip to content

Commit

Permalink
Support JDK_VERSION in JenkinsfileBase
Browse files Browse the repository at this point in the history
- replace JAVA_VERSION by JDK_VERSION
- temporarily support JAVA_VERSION. If JAVA_VERSION is provided, map it
to JDK_VERSION
- update get.sh to consume JDK_VERSION

Issue: #869

Signed-off-by: lanxia <[email protected]>
  • Loading branch information
llxia committed Feb 12, 2019
1 parent 533e256 commit 1ad0c93
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
28 changes: 9 additions & 19 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ def setupEnv() {
])
}

// env.JAVA_VERSION = "${getJavaVersionFromJvmVersion()}"
env.JAVA_VERSION = "${JAVA_VERSION}"
/* Optional parameter JAVA_VERSION to use for Panama/Valhalla/Amber cases, otherwise its calculated from JVM_VERSION */
if( params.JAVA_VERSION ) {
env.JAVA_VERSION = params.JAVA_VERSION
if ( params.JDK_VERSION ) {
env.JDK_VERSION = params.JDK_VERSION
} else if ( params.JAVA_VERSION ) { // temporarily support JAVA_VERSION
env.JDK_VERSION = (params.JAVA_VERSION.trim())[2..-2];
}

env.JAVA_BIN = "$WORKSPACE/openjdkbinary/j2sdk-image/${(JAVA_VERSION == 'SE80') ? 'jre/' : ''}bin"
env.JAVA_BIN = "$WORKSPACE/openjdkbinary/j2sdk-image/${(JDK_VERSION == '8') ? 'jre/' : ''}bin"
env.JRE_IMAGE = "$WORKSPACE/openjdkbinary/j2jre-image"
env.JAVA_HOME = "${JAVA_BIN}/.."
env.JVM_VERSION = params.JVM_VERSION ? params.JVM_VERSION : ""
Expand Down Expand Up @@ -67,10 +66,10 @@ def setupEnv() {
}

if (env.BUILD_LIST.startsWith("jck")) {
if ( JAVA_VERSION == "SE80" ) {
if ( JDK_VERSION == "8" ) {
env.JCK_VERSION = "jck8b"
} else {
env.JCK_VERSION = "jck${JAVA_VERSION[2..-2]}"
env.JCK_VERSION = "jck${JDK_VERSION}"
}
env.JCK_ROOT = "$WORKSPACE/../jck_root"
echo "env.JCK_ROOT is: ${env.JCK_ROOT}, env.JCK_VERSION is: ${env.JCK_VERSION}"
Expand Down Expand Up @@ -119,7 +118,7 @@ def setupParallelEnv() {
string(name: 'ADOPTOPENJDK_BRANCH', value: ADOPTOPENJDK_BRANCH),
string(name: 'OPENJ9_REPO', value: OPENJ9_REPO),
string(name: 'OPENJ9_BRANCH', value: OPENJ9_BRANCH),
string(name: 'JAVA_VERSION', value: JAVA_VERSION),
string(name: 'JDK_VERSION', value: JDK_VERSION),
string(name: 'JDK_IMPL', value: JDK_IMPL),
string(name: 'BUILD_LIST', value: "${env.BUILD_LIST}/${testSubDir}"),
string(name: 'TARGET', value: TARGET),
Expand Down Expand Up @@ -191,7 +190,7 @@ def setup() {
VENDOR_TEST_BRANCHES = (params.VENDOR_TEST_BRANCHES) ? "--vendor_branches \"${params.VENDOR_TEST_BRANCHES}\"" : ""
VENDOR_TEST_DIRS = (params.VENDOR_TEST_DIRS) ? "--vendor_dirs \"${params.VENDOR_TEST_DIRS}\"" : ""
VENDOR_TEST_SHAS = (params.VENDOR_TEST_SHAS) ? "--vendor_shas \"${params.VENDOR_TEST_SHAS}\"" : ""
GET_SH_CMD = "./openjdk-tests/get.sh -s `pwd` -t `pwd`/openjdk-tests -p $PLATFORM -r ${SDK_RESOURCE} -j ${JAVA_VERSION} -i ${JDK_IMPL} ${CUSTOMIZED_SDK_URL_OPTION} ${OPENJ9_REPO_OPTION} ${OPENJ9_BRANCH_OPTION} ${OPENJ9_SHA_OPTION} ${VENDOR_TEST_REPOS} ${VENDOR_TEST_BRANCHES} ${VENDOR_TEST_DIRS} ${VENDOR_TEST_SHAS}"
GET_SH_CMD = "./openjdk-tests/get.sh -s `pwd` -t `pwd`/openjdk-tests -p $PLATFORM -r ${SDK_RESOURCE} -j ${JDK_VERSION} -i ${JDK_IMPL} ${CUSTOMIZED_SDK_URL_OPTION} ${OPENJ9_REPO_OPTION} ${OPENJ9_BRANCH_OPTION} ${OPENJ9_SHA_OPTION} ${VENDOR_TEST_REPOS} ${VENDOR_TEST_BRANCHES} ${VENDOR_TEST_DIRS} ${VENDOR_TEST_SHAS}"

dir( WORKSPACE) {
// use sshagent with Jenkins credentials ID for all platforms except zOS
Expand Down Expand Up @@ -388,15 +387,6 @@ def testBuild() {
}
}

def getJavaVersionFromJvmVersion() {
String regex = ${JVM_VERSION}
def m = regex =~ /^openjdk(\d+)(-openj9|-sap)?$/
def match = m[0][1]
def java_version = "SE$match0"
echo "java_version=$java_version"
return java_version
}

def getJDKImpl(jvm_version) {
def jdk_impl = 'hotspot'
if (jvm_version.contains('openj9')) {
Expand Down
7 changes: 2 additions & 5 deletions get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ VENDOR_REPOS=""
VENDOR_SHAS=""
VENDOR_BRANCHES=""
VENDOR_DIRS=""
JDK_VERSION="SE80"
JDK_VERSION="8"
JDK_IMPL="openj9"
RELEASES="latest"
TYPE="jdk"
Expand Down Expand Up @@ -141,10 +141,7 @@ getBinaryOpenjdk()
os=${PLATFORM#*_}
os=${os%_largeHeap}
arch=${PLATFORM%%_*}
tempJDK_VERSION="${JDK_VERSION%?}"
OPENJDK_VERSION="openjdk${tempJDK_VERSION:2}"
# older bash doesn't support negative offset
# OPENJDK_VERSION="openjdk${JDK_VERSION:2:-1}"
OPENJDK_VERSION="openjdk${JDK_VERSION}"
heap_size="normal"
if [[ $PLATFORM = *"largeHeap"* ]]; then
heap_size="large"
Expand Down

0 comments on commit 1ad0c93

Please sign in to comment.