Skip to content

Commit

Permalink
enables EBC for test inside semeru builds
Browse files Browse the repository at this point in the history
It add a function called allocateEBCnodesForTest which return label for new generated EBC nodes and let test use it.

Signed-off-by: Mahdi Ardekanian <[email protected]>
  • Loading branch information
mahdipub committed Feb 19, 2024
1 parent a1bf8c1 commit 0f8dca7
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 3 deletions.
82 changes: 82 additions & 0 deletions pipelines/build/common/openjdk_build_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -292,6 +298,81 @@ 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 ''
}

// context.library 'jenkins-ci-websphere'
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)
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}"

context.stage('EBC node creation') {
def jobName = '/EBC_Create_Node'
def ebcJob = context.build job: jobName,
propagate: false,
wait: true,
parameters: [
context.string(name: 'group_label', value: group_label_UUID),
context.string(name: 'ebcPlan', value: 'hur-runtimesJenkins-ubuntu22_x86.yml'),
context.string(name: 'ebcShortlist', value: ''),
context.string(name: 'NUM_MACHINES', value: num_machines),
context.string(name: 'TIME_LIMIT', value: '1')
]
}
// currentBuild.result = ebcJob.getResult()
return group_label_UUID

// 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: ['[email protected]: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']]

// 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.
Expand Down Expand Up @@ -2211,6 +2292,7 @@ class Build {
*/
@SuppressWarnings('unused')
def build() {
allocateEBCnodesForTest('sanity.functional')
context.timestamps {
try {
context.println 'Build config (BUILD_CONFIGURAION):'
Expand Down
7 changes: 4 additions & 3 deletions pipelines/defaults.json
Original file line number Diff line number Diff line change
@@ -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" : "[email protected]:runtimes/adoptium-installer.git",
"installer_branch" : "ibm",
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0f8dca7

Please sign in to comment.