Skip to content

Commit a31cd9e

Browse files
authored
Check remote JCK job asynchronously and set stage status correspondingly (#1189)
* Check remote JCK job asynchronously and set stage status correspondingly * Set jck stage when query the result
1 parent bbce645 commit a31cd9e

File tree

1 file changed

+53
-36
lines changed

1 file changed

+53
-36
lines changed

pipelines/build/common/openjdk_build_pipeline.groovy

Lines changed: 53 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ class Build {
567567
def sdkUrl = "${env.BUILD_URL}/artifact/workspace/target/${jdkFileName}"
568568
context.echo "sdkUrl is ${sdkUrl}"
569569
def remoteTargets = [:]
570+
def remoteTriggeredBuilds = [:]
570571
def additionalTestLabel = buildConfig.ADDITIONAL_TEST_LABEL
571572
def aqaAutoGen = buildConfig.AQA_AUTO_GEN ?: false
572573
def setupJCKRun = false
@@ -621,17 +622,17 @@ class Build {
621622

622623
targets.each { targetMode, targetTests ->
623624
try {
624-
context.println "Remote trigger: ${targetTests}"
625625
remoteTargets["${targetTests}"] = {
626+
context.println "Remote trigger: ${targetTests}"
626627
def displayName = "jdk${jdkVersion} : ${buildConfig.SCM_REF} : ${platform} : ${targetTests}"
627628
def parallel = 'None'
628629
def num_machines = '1'
629630
if ("${targetMode}" == 'parallel') {
630-
parallel = 'Dynamic'
631-
num_machines = '2'
631+
parallel = 'Dynamic'
632+
num_machines = '2'
632633
}
633634
context.catchError {
634-
context.triggerRemoteJob abortTriggeredJob: true,
635+
remoteTriggeredBuilds["${targetTests}"] = context.triggerRemoteJob abortTriggeredJob: true,
635636
blockBuildUntilComplete: false,
636637
job: 'AQA_Test_Pipeline',
637638
parameters: context.MapParameters(parameters: [context.MapParameter(name: 'SDK_RESOURCE', value: 'customized'),
@@ -661,8 +662,8 @@ class Build {
661662
context.println "Failed to remote trigger jck tests: ${e.message}"
662663
}
663664
}
664-
665-
return remoteTargets
665+
context.parallel remoteTargets
666+
return remoteTriggeredBuilds
666667
}
667668

668669
def compareReproducibleBuild(String nonDockerNodeName) {
@@ -2508,41 +2509,57 @@ def buildScriptsAssemble(
25082509

25092510
// Run Smoke Tests and AQA Tests
25102511
if (enableTests) {
2511-
if (currentBuild.currentResult != "SUCCESS") {
2512-
context.println('[ERROR] Build stages were not successful, not running AQA tests')
2513-
} else {
2514-
try {
2515-
//Only smoke tests succeed TCK and AQA tests will be triggerred.
2516-
context.println "openjdk_build_pipeline: running smoke tests"
2517-
if (runSmokeTests() == 'SUCCESS') {
2518-
context.println "openjdk_build_pipeline: smoke tests OK - running full AQA suite"
2519-
// Remote trigger Eclipse Temurin JCK tests
2520-
if (buildConfig.VARIANT == 'temurin' && enableTCK) {
2521-
def platform = ''
2522-
if (buildConfig.ARCHITECTURE.contains('x64')) {
2523-
platform = 'x86-64_' + buildConfig.TARGET_OS
2524-
} else {
2525-
platform = buildConfig.ARCHITECTURE + '_' + buildConfig.TARGET_OS
2526-
}
2527-
if ( !(buildConfig.JAVA_TO_BUILD == 'jdk8u' && platform == 's390x_linux') ) {
2528-
context.echo "openjdk_build_pipeline: Remote trigger Eclipse Temurin AQA_Test_Pipeline job with ${platform} ${buildConfig.JAVA_TO_BUILD}"
2529-
def remoteTargets = remoteTriggerJckTests(platform, filename)
2530-
context.parallel remoteTargets
2512+
if (currentBuild.currentResult != "SUCCESS") {
2513+
context.println('[ERROR] Build stages were not successful, not running AQA tests')
2514+
} else {
2515+
try {
2516+
//Only smoke tests succeed TCK and AQA tests will be triggerred.
2517+
context.println "openjdk_build_pipeline: running smoke tests"
2518+
if (runSmokeTests() == 'SUCCESS') {
2519+
context.println "openjdk_build_pipeline: smoke tests OK - running full AQA suite"
2520+
// Remote trigger Eclipse Temurin JCK tests
2521+
def remoteTriggeredBuilds = [:]
2522+
if (buildConfig.VARIANT == 'temurin' && enableTCK) {
2523+
def platform = ''
2524+
if (buildConfig.ARCHITECTURE.contains('x64')) {
2525+
platform = 'x86-64_' + buildConfig.TARGET_OS
2526+
} else {
2527+
platform = buildConfig.ARCHITECTURE + '_' + buildConfig.TARGET_OS
2528+
}
2529+
if ( !(buildConfig.JAVA_TO_BUILD == 'jdk8u' && platform == 's390x_linux') ) {
2530+
context.echo "openjdk_build_pipeline: Remote trigger Eclipse Temurin AQA_Test_Pipeline job with ${platform} ${buildConfig.JAVA_TO_BUILD}"
2531+
//def remoteTargets = remoteTriggerJckTests(platform, filename)
2532+
//context.parallel remoteTargets
2533+
remoteTriggeredBuilds = remoteTriggerJckTests(platform, filename)
2534+
}
25312535
}
2532-
}
25332536

2534-
if (buildConfig.TEST_LIST.size() > 0) {
2535-
def testStages = runAQATests()
2536-
context.parallel testStages
2537+
if (buildConfig.TEST_LIST.size() > 0) {
2538+
def testStages = runAQATests()
2539+
context.parallel testStages
2540+
}
2541+
2542+
// Asynchronously get the remote JCK job status and set as the stage status.
2543+
if (buildConfig.VARIANT == 'temurin' && enableTCK && remoteTriggeredBuilds.asBoolean()) {
2544+
remoteTriggeredBuilds.each{ testTargets, jobHandle ->
2545+
context.stage("${testTargets}") {
2546+
while( !jobHandle.isFinished() ) {
2547+
context.println "Current ${testTargets} Status: " + jobHandle.getBuildStatus().toString();
2548+
sleep 3600
2549+
jobHandle.updateBuildStatus()
2550+
}
2551+
setStageResult("${testTargets}", jobHandle.getBuildResult().toString());
2552+
}
2553+
}
2554+
}
2555+
} else {
2556+
context.println('[ERROR]Smoke tests are not successful! AQA and Tck tests are blocked ')
25372557
}
2538-
} else {
2539-
context.println('[ERROR]Smoke tests are not successful! AQA and Tck tests are blocked ')
2558+
} catch (Exception e) {
2559+
context.println(e.message)
2560+
currentBuild.result = 'FAILURE'
25402561
}
2541-
} catch (Exception e) {
2542-
context.println(e.message)
2543-
currentBuild.result = 'FAILURE'
25442562
}
2545-
}
25462563
}
25472564

25482565
// Compare reproducible build if needed

0 commit comments

Comments
 (0)