From a4cefa1650a6ced0699c5eeb3d720446f67251e6 Mon Sep 17 00:00:00 2001 From: Anna Babu Palathingal <148897727+annaibm@users.noreply.github.com> Date: Tue, 7 May 2024 10:25:59 -0400 Subject: [PATCH] Update customUrl to dynamically use Jenkins domain - Dynamically build the customUrl using the extracted domain using getJenkinsDomain() resolves:https://github.com/adoptium/aqa-tests/issues/5286 Signed-off-by: Anna Babu Palathingal --- buildenv/jenkins/JenkinsfileBase | 33 +++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/buildenv/jenkins/JenkinsfileBase b/buildenv/jenkins/JenkinsfileBase index f33a0e9d6a..e87431a3af 100644 --- a/buildenv/jenkins/JenkinsfileBase +++ b/buildenv/jenkins/JenkinsfileBase @@ -39,7 +39,7 @@ def setupEnv() { env.JOBSTARTTIME = sh(script: 'LC_TIME=C date +"%a, %d %b %Y %T %z"', returnStdout: true).trim() // Terminate any previous test related processes that are running - terminateTestProcesses() + terminateTestProcesses() if ( params.JDK_VERSION ) { env.ORIGIN_JDK_VERSION = params.JDK_VERSION @@ -207,7 +207,8 @@ def setupParallelEnv() { // check for each lib. If lib does not exist, donwload it. // If lib exists, SHA will be checked. Re-download if SHA does not match. timeout(time: 20, unit: 'MINUTES') { - def customUrl = "https://ci.adoptium.net/job/test.getDependency/lastSuccessfulBuild/artifact/" + def customUrl = getCustomUrl() + echo "Custom URL: ${customUrl}" if (PLATFORM.contains("windows")) { env.LIB_DIR = env.LIB_DIR.replaceAll("\\\\", "/") } @@ -315,7 +316,7 @@ def setupParallelEnv() { } -// Returns NUM_LIST from parallelList.mk. +// Returns NUM_LIST from parallelList.mk. // NUM_LIST can be different than numOfMachines. def genParallelList(PARALLEL_OPTIONS) { String unsetLLP = "" @@ -415,7 +416,7 @@ def setup() { if (params.SDK_RESOURCE == 'nightly') { // remove single quote to allow variables to be set in CUSTOMIZED_SDK_URL CUSTOMIZED_SDK_URL_OPTION = "-c ${params.CUSTOMIZED_SDK_URL}" - } else if (!params.SDK_RESOURCE || params.SDK_RESOURCE == 'customized') { + } else if (!params.SDK_RESOURCE || params.SDK_RESOURCE == 'customized') { SDK_RESOURCE = "customized" CUSTOMIZED_SDK_URL_OPTION = "-c '${params.CUSTOMIZED_SDK_URL}'" if (params.ADDITIONAL_ARTIFACTS_REQUIRED == "RI_JDK") { @@ -437,7 +438,7 @@ def setup() { error("SDK_RESOURCE: ${params.SDK_RESOURCE} and CUSTOMIZED_SDK_URL: ${params.CUSTOMIZED_SDK_URL} combo is not supported!") } } else { - if (params.SDK_RESOURCE == 'customized') { + if (params.SDK_RESOURCE == 'customized') { error("SDK_RESOURCE: ${params.SDK_RESOURCE}, please provide CUSTOMIZED_SDK_URL") } else { CUSTOMIZED_SDK_URL_OPTION = "" @@ -466,7 +467,7 @@ def setup() { if (CLONE_OPENJ9_OPTION == "") { if (env.BUILD_LIST.contains('functional')) { CLONE_OPENJ9_OPTION = "--clone_openj9 true" - // If USE_TESTENV_PROPERTIES = false, set Openj9 repo and brnach. + // If USE_TESTENV_PROPERTIES = false, set Openj9 repo and brnach. // Otherwise, testenv.properties will be used. // And the Openj9 repo and brnach values will be set in get.sh if(!params.USE_TESTENV_PROPERTIES) { @@ -655,7 +656,8 @@ def buildTest() { // check for each lib. If lib does not exist, donwload it. // If lib exists, SHA will be checked. Re-download if SHA does not match. timeout(time: 20, unit: 'MINUTES') { - def customUrl = "https://ci.adoptium.net/job/test.getDependency/lastSuccessfulBuild/artifact/" + def customUrl = getCustomUrl() + echo "Custom URL: ${customUrl}" if (PLATFORM.contains("windows")) { env.LIB_DIR = env.LIB_DIR.replaceAll("\\\\", "/") } @@ -1013,10 +1015,10 @@ def testExecution() { def terminateTestProcesses() { echo "PROCESSCATCH: Terminating any hung/left over test processes:" - def statusCode=sh(script:"aqa-tests/terminateTestProcesses.sh ${env.USER} 2>&1", returnStatus:true) - if (statusCode != 0) { - echo "rc = ${statusCode}, Unable to terminate all processes." - } + def statusCode=sh(script:"aqa-tests/terminateTestProcesses.sh ${env.USER} 2>&1", returnStatus:true) + if (statusCode != 0) { + echo "rc = ${statusCode}, Unable to terminate all processes." + } } def getJDKImpl(jvm_version) { @@ -1054,6 +1056,15 @@ def getJenkinsDomain() { return domainName } +def getCustomUrl() { + def jenkinsDomain = getJenkinsDomain() + if (jenkinsDomain.contains("hyc-runtimes")) { + jenkinsDomain = "openj9-jenkins.osuosl.org" + } + def customUrl = "https://${jenkinsDomain}/job/test.getDependency/lastSuccessfulBuild/artifact/" + return customUrl +} + def archiveAQAvitFiles() { if (params.USE_TESTENV_PROPERTIES && !JOB_NAME.contains("_testList_")) { if (params.ARTIFACTORY_SERVER) {