Skip to content

Commit ccec098

Browse files
committed
Trigger rerun builds without holding an extra machine
Signed-off-by: Lan Xia <[email protected]>
1 parent d3376be commit ccec098

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

buildenv/jenkins/JenkinsfileBase

+7-9
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def setupEnv() {
8282
env.DYNAMIC_COMPILE=params.DYNAMIC_COMPILE ? params.DYNAMIC_COMPILE : false
8383
env.USE_JRE=params.USE_JRE ? params.USE_JRE : false
8484
env.RERUN_LINK = ""
85+
env.FAILED_TESTS = ""
8586
env.FAILED_TEST_TARGET = ""
8687
env.CUSTOM_TARGET_KEY_VALUE =""
8788
env.DOCKER_REGISTRY_URL = params.DOCKER_REGISTRY_URL ? params.DOCKER_REGISTRY_URL : ""
@@ -860,8 +861,7 @@ def post(output_name) {
860861
uploadToArtifactory(pattern)
861862
}
862863
}
863-
String failedTests = addFailedTestsGrinderLink()
864-
triggerRerunJob(failedTests)
864+
addFailedTestsGrinderLink()
865865
}
866866
}
867867

@@ -1154,6 +1154,7 @@ def addFailedTestsGrinderLink(paths=""){
11541154
}
11551155
if (failedTestList) {
11561156
String failedTests = failedTestList.substring(0, failedTestList.length() - 1)
1157+
env.FAILED_TESTS= failedTests ?: ""
11571158
failedTestList = "testList+TESTLIST=" + failedTests
11581159
String url = env.RERUN_LINK
11591160
def failedTestUrl = url.replace(env.FAILED_TEST_TARGET, "TARGET=$failedTestList")
@@ -1174,9 +1175,7 @@ def addFailedTestsGrinderLink(paths=""){
11741175
echo "Rerun failed ${target} test cases in Grinder with ${target}_custom target: ${customURL}"
11751176
currentBuild.description += "<br><a href=${customURL}> Rerun failed ${target} test cases in Grinder with ${target}_custom target</a>"
11761177
}
1177-
return failedTests;
11781178
}
1179-
return null;
11801179
}
11811180
}
11821181

@@ -1204,11 +1203,11 @@ def generateJob (newJobs, childTest, testJobName) {
12041203
}
12051204
}
12061205
}
1207-
def triggerRerunJob (failedTests) {
1206+
def triggerRerunJob () {
12081207
// if the JOB_NAME contains _rerun or _testList_, we will not trigger rerun job
12091208
if (!JOB_NAME.contains("_rerun") && !JOB_NAME.contains("_testList_") && !JOB_NAME.contains("_iteration_")) {
12101209
int rerunIterations = params.RERUN_ITERATIONS ? params.RERUN_ITERATIONS.toInteger() : 0
1211-
if (rerunIterations > 0 && failedTests) {
1210+
if (rerunIterations > 0 && env.FAILED_TESTS?.trim()) {
12121211
stage('Rerun') {
12131212
def rerunJobName = "${JOB_NAME}_rerun"
12141213
def newJobs = [:]
@@ -1221,7 +1220,7 @@ def triggerRerunJob (failedTests) {
12211220
// set PARALLEL, NUM_MACHINES and TEST_TIME to default values
12221221
// set TARGET to failed tests and set ITERATIONS to rerunIterations
12231222
if (param.key == "TARGET") {
1224-
childParams << string(name: param.key, value: "testList TESTLIST=" + failedTests )
1223+
childParams << string(name: param.key, value: "testList TESTLIST=" + env.FAILED_TESTS)
12251224
} else if (param.key == "PARALLEL") {
12261225
childParams << string(name: param.key, value: "None")
12271226
} else if (param.key == "NUM_MACHINES") {
@@ -1281,8 +1280,7 @@ def run_parallel_tests() {
12811280

12821281
archiveAQAvitFiles()
12831282
if (buildPaths.length() > 0) {
1284-
String failedTests = addFailedTestsGrinderLink(buildPaths.substring(0, buildPaths.length() - 1))
1285-
triggerRerunJob(failedTests)
1283+
addFailedTestsGrinderLink(buildPaths.substring(0, buildPaths.length() - 1))
12861284
}
12871285
} finally {
12881286
forceCleanWS()

buildenv/jenkins/openjdk_tests

+1
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ timestamps{
340340
}
341341
if (currentBuild.result != 'FAILURE') {
342342
jenkinsfile.run_parallel_tests()
343+
jenkinsfile.triggerRerunJob()
343344
}
344345
} else {
345346
assert false : "Cannot find key PLATFORM: ${params.PLATFORM} in PLATFORM_MAP: ${PLATFORM_MAP}."

0 commit comments

Comments
 (0)