Skip to content

Commit

Permalink
Check remote JCK job asynchronously and set stage status correspondin…
Browse files Browse the repository at this point in the history
…gly (#1189)

* Check remote JCK job asynchronously and set stage status correspondingly

* Set jck stage when query the result
  • Loading branch information
sophia-guo authored Feb 27, 2025
1 parent bbce645 commit a31cd9e
Showing 1 changed file with 53 additions and 36 deletions.
89 changes: 53 additions & 36 deletions pipelines/build/common/openjdk_build_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ class Build {
def sdkUrl = "${env.BUILD_URL}/artifact/workspace/target/${jdkFileName}"
context.echo "sdkUrl is ${sdkUrl}"
def remoteTargets = [:]
def remoteTriggeredBuilds = [:]
def additionalTestLabel = buildConfig.ADDITIONAL_TEST_LABEL
def aqaAutoGen = buildConfig.AQA_AUTO_GEN ?: false
def setupJCKRun = false
Expand Down Expand Up @@ -621,17 +622,17 @@ class Build {

targets.each { targetMode, targetTests ->
try {
context.println "Remote trigger: ${targetTests}"
remoteTargets["${targetTests}"] = {
context.println "Remote trigger: ${targetTests}"
def displayName = "jdk${jdkVersion} : ${buildConfig.SCM_REF} : ${platform} : ${targetTests}"
def parallel = 'None'
def num_machines = '1'
if ("${targetMode}" == 'parallel') {
parallel = 'Dynamic'
num_machines = '2'
parallel = 'Dynamic'
num_machines = '2'
}
context.catchError {
context.triggerRemoteJob abortTriggeredJob: true,
remoteTriggeredBuilds["${targetTests}"] = context.triggerRemoteJob abortTriggeredJob: true,
blockBuildUntilComplete: false,
job: 'AQA_Test_Pipeline',
parameters: context.MapParameters(parameters: [context.MapParameter(name: 'SDK_RESOURCE', value: 'customized'),
Expand Down Expand Up @@ -661,8 +662,8 @@ class Build {
context.println "Failed to remote trigger jck tests: ${e.message}"
}
}

return remoteTargets
context.parallel remoteTargets
return remoteTriggeredBuilds
}

def compareReproducibleBuild(String nonDockerNodeName) {
Expand Down Expand Up @@ -2508,41 +2509,57 @@ def buildScriptsAssemble(

// Run Smoke Tests and AQA Tests
if (enableTests) {
if (currentBuild.currentResult != "SUCCESS") {
context.println('[ERROR] Build stages were not successful, not running AQA tests')
} else {
try {
//Only smoke tests succeed TCK and AQA tests will be triggerred.
context.println "openjdk_build_pipeline: running smoke tests"
if (runSmokeTests() == 'SUCCESS') {
context.println "openjdk_build_pipeline: smoke tests OK - running full AQA suite"
// Remote trigger Eclipse Temurin JCK tests
if (buildConfig.VARIANT == 'temurin' && enableTCK) {
def platform = ''
if (buildConfig.ARCHITECTURE.contains('x64')) {
platform = 'x86-64_' + buildConfig.TARGET_OS
} else {
platform = buildConfig.ARCHITECTURE + '_' + buildConfig.TARGET_OS
}
if ( !(buildConfig.JAVA_TO_BUILD == 'jdk8u' && platform == 's390x_linux') ) {
context.echo "openjdk_build_pipeline: Remote trigger Eclipse Temurin AQA_Test_Pipeline job with ${platform} ${buildConfig.JAVA_TO_BUILD}"
def remoteTargets = remoteTriggerJckTests(platform, filename)
context.parallel remoteTargets
if (currentBuild.currentResult != "SUCCESS") {
context.println('[ERROR] Build stages were not successful, not running AQA tests')
} else {
try {
//Only smoke tests succeed TCK and AQA tests will be triggerred.
context.println "openjdk_build_pipeline: running smoke tests"
if (runSmokeTests() == 'SUCCESS') {
context.println "openjdk_build_pipeline: smoke tests OK - running full AQA suite"
// Remote trigger Eclipse Temurin JCK tests
def remoteTriggeredBuilds = [:]
if (buildConfig.VARIANT == 'temurin' && enableTCK) {
def platform = ''
if (buildConfig.ARCHITECTURE.contains('x64')) {
platform = 'x86-64_' + buildConfig.TARGET_OS
} else {
platform = buildConfig.ARCHITECTURE + '_' + buildConfig.TARGET_OS
}
if ( !(buildConfig.JAVA_TO_BUILD == 'jdk8u' && platform == 's390x_linux') ) {
context.echo "openjdk_build_pipeline: Remote trigger Eclipse Temurin AQA_Test_Pipeline job with ${platform} ${buildConfig.JAVA_TO_BUILD}"
//def remoteTargets = remoteTriggerJckTests(platform, filename)
//context.parallel remoteTargets
remoteTriggeredBuilds = remoteTriggerJckTests(platform, filename)
}
}
}

if (buildConfig.TEST_LIST.size() > 0) {
def testStages = runAQATests()
context.parallel testStages
if (buildConfig.TEST_LIST.size() > 0) {
def testStages = runAQATests()
context.parallel testStages
}

// Asynchronously get the remote JCK job status and set as the stage status.
if (buildConfig.VARIANT == 'temurin' && enableTCK && remoteTriggeredBuilds.asBoolean()) {
remoteTriggeredBuilds.each{ testTargets, jobHandle ->
context.stage("${testTargets}") {
while( !jobHandle.isFinished() ) {
context.println "Current ${testTargets} Status: " + jobHandle.getBuildStatus().toString();
sleep 3600
jobHandle.updateBuildStatus()
}
setStageResult("${testTargets}", jobHandle.getBuildResult().toString());
}
}
}
} else {
context.println('[ERROR]Smoke tests are not successful! AQA and Tck tests are blocked ')
}
} else {
context.println('[ERROR]Smoke tests are not successful! AQA and Tck tests are blocked ')
} catch (Exception e) {
context.println(e.message)
currentBuild.result = 'FAILURE'
}
} catch (Exception e) {
context.println(e.message)
currentBuild.result = 'FAILURE'
}
}
}

// Compare reproducible build if needed
Expand Down

0 comments on commit a31cd9e

Please sign in to comment.