diff --git a/pipelines/build/common/openjdk_build_pipeline.groovy b/pipelines/build/common/openjdk_build_pipeline.groovy index cdc487c00..22efb585b 100644 --- a/pipelines/build/common/openjdk_build_pipeline.groovy +++ b/pipelines/build/common/openjdk_build_pipeline.groovy @@ -176,6 +176,12 @@ class Build { def jobName = "Test_openjdk${jobParams['JDK_VERSIONS']}_${variant}_${testType}_${jobParams['ARCH_OS_LIST']}" jobParams.put('TEST_JOB_NAME', jobName) + context.println jobParams + context.println 'BEFOR EBC CALL MAHDI' + def EBC_LABEL = allocateEBCnodesForTest(testType) + jobParams.put('LABEL', EBC_LABEL) + context.println 'AFTER EBC CALL MAHDI' + context.println jobParams return jobParams } @@ -292,6 +298,66 @@ class Build { return jdkRepo } + + private String allocateEBCnodesForTest(testType) { + context.println '1 ------------------------------' + context.println DEFAULTS_JSON + context.println "calling allocateEBCnodesForTest with param ${testType}" + def test_target = buildConfig.ARCHITECTURE + '_' + buildConfig.TARGET_OS + context.println "test_target: ${test_target}" + context.println '2 ------------------------------' + context.println "DEFAULTS_JSON['testDetails']['ebcEnabledTargets']: ${DEFAULTS_JSON['testDetails']['ebcEnabledTargets']}" + // All targets are not supported via EBC yet. We need to test that target and add to default.json later on to make it enable + if ( ! DEFAULTS_JSON['testDetails']['ebcEnabledTargets'].find { it == test_target } ) { + return '' + } + + def EBCHelper = context.library(identifier: 'jenkins-ci-websphere@dev') + def group_label_UUID = 'Adopt-semeru_test_machine_' + UUID.randomUUID().toString() + def num_machines = 0 + def test_index = DEFAULTS_JSON['testDetails']['defaultDynamicParas']['testLists'].indexOf(testType) + num_machines = DEFAULTS_JSON['testDetails']['defaultDynamicParas']['numMachines'].get(test_index).toInteger() + def nodes_ebc_args = new Object[num_machines] + + if (num_machines == 0 ) { + num_machines = 1 + } + + context.println "test_index: ${test_index} , num_machines: ${num_machines}" + + for (def i = 0; i < num_machines; i++){ + context.println "********* $i ************" + try{ + def node_uuid = UUID.randomUUID().toString() + context.println "Running Build with demandId: $node_uuid" + def ebc_args = [demandId: node_uuid, + ebcPlan: 'hur-runtimesJenkins-ubuntu22_x86.yml', + ebcShortlist: '', + autoCompleteAfterXHours: 3, + ebcBranch: 'dev', + credentialsId: 'b88df0bc-be85-435e-9b25-88146f57b5b5', + extraProps: ['ebc_remotePlaybook_gitRepoUrl=git@github.ibm.com:mahdi/infra-can.git', + 'ebc_jenkins_server_instance_name=hyc-runtimes-jenkins.swg-devops.com', + 'ebc_jenkins_service_name=runtimes-jenkins', + "ebc_jenkins_agent_label=${group_label_UUID}", + 'ebc_remotePlaybook_gitBranch=EBC', + 'ebc_remotePlaybook_file=ansible/playbooks/EBC/prepare_test.yml', + 'ebc_remotePlaybook_jenkinsUserSshPubKey=unused']] + + EBCHelper.ebcJenkinsNodeDemand(ebc_args) + nodes_ebc_args[i] = ebc_args + node(label: group_label_UUID){ + sh "echo '### EBC node with label #${group_label_UUID} prepared ###'" + } + } catch (Exception e) { + context.println '------ catched exception ------' + context.println e + } + } + context.println "group_label_UUID: ${group_label_UUID}" + return group_label_UUID + } + /* Run smoke tests, which should block the running of downstream test jobs if there are failures. If a test job that doesn't exist, it will be created dynamically. @@ -2211,6 +2277,7 @@ class Build { */ @SuppressWarnings('unused') def build() { + allocateEBCnodesForTest('sanity.functional') context.timestamps { try { context.println 'Build config (BUILD_CONFIGURAION):' diff --git a/pipelines/defaults.json b/pipelines/defaults.json index 4a478f2e8..7a50ebac2 100644 --- a/pipelines/defaults.json +++ b/pipelines/defaults.json @@ -1,9 +1,9 @@ { "repository" : { "test_dirs" : "/test/functional", - "build_url" : "https://github.com/ibmruntimes/temurin-build.git", + "build_url" : "https://github.com/mahdipub/temurin-build.git", "build_branch" : "ibm", - "pipeline_url" : "https://github.com/ibmruntimes/ci-jenkins-pipelines.git", + "pipeline_url" : "https://github.com/mahdipub/ci-jenkins-pipelines.git", "pipeline_branch" : "ibm", "installer_url" : "git@github.ibm.com:runtimes/adoptium-installer.git", "installer_branch" : "ibm", @@ -90,7 +90,8 @@ "defaultDynamicParas": { "testLists" : ["sanity.functional", "extended.functional", "sanity.system", "extended.system", "special.system", "sanity.jck", "extended.jck", "sanity.openjdk", "dev.system"], "numMachines" : ["3", "3", "3", "3", "5", "4", "8", "2", "5"] - } + }, + "ebcEnabledTargets":["x64_linux"] }, "enableInstallers" : true, "enableSourceRpm" : true,