Skip to content

Commit

Permalink
Do not move the test to child job if parallel list number=1
Browse files Browse the repository at this point in the history
Signed-off-by: Sophia Guo <[email protected]>
  • Loading branch information
sophia-guo committed Aug 17, 2024
1 parent dcef912 commit 3165781
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,23 @@ def setupParallelEnv() {
NUM_LIST = genParallelList(PARALLEL_OPTIONS)
}

if (NUM_LIST > 0) {
if (NUM_LIST > 1) {
childJobNum = NUM_LIST
echo "Saving parallelList.mk file on jenkins..."
dir('aqa-tests/TKG') {
archiveArtifacts artifacts: 'parallelList.mk', fingerprint: true, allowEmptyArchive: false
}
} else if (NUM_LIST == 1) {
echo " Number of test list is 1, no need to run tests in child job."
return NUM_LIST
} else {
assert false : "Build failed because cannot find NUM_LIST in parallelList.mk file."
}
}

UPSTREAM_TEST_JOB_NAME = JOB_NAME
UPSTREAM_TEST_JOB_NUMBER = BUILD_NUMBER

echo "[PARALLEL: ${params.PARALLEL}] childJobNum is ${childJobNum}, creating jobs and running them in parallel..."
parallel_tests = [:]
create_jobs = [:]
Expand Down Expand Up @@ -315,7 +319,7 @@ def setupParallelEnv() {
if (create_jobs) {
parallel create_jobs
}

return NUM_LIST
// return to top level pipeline file in order to exit node block before running tests in parallel
}

Expand Down Expand Up @@ -969,7 +973,10 @@ def testBuild() {
// prepare environment and compile test projects
if ((params.PARALLEL == "NodesByIterations" && NUM_MACHINES > 1)
|| (params.PARALLEL == "Dynamic" && (NUM_MACHINES > 1 || (params.TEST_TIME && !params.NUM_MACHINES)))) {
setupParallelEnv()
if (setupParallelEnv() == 1) {
// No need to run tests in parallel
testExecution()
}
} else {
testExecution()
}
Expand Down

0 comments on commit 3165781

Please sign in to comment.