Skip to content

Commit

Permalink
Do not move the test to child job if parallel list number=1 (adoptium…
Browse files Browse the repository at this point in the history
…#5511)

Signed-off-by: Sophia Guo <[email protected]>
  • Loading branch information
sophia-guo committed Aug 20, 2024
1 parent 5e8790b commit e8802e1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def setupParallelEnv() {
int childJobNum = 1
def UPSTREAM_TEST_JOB_NAME = ""
def UPSTREAM_TEST_JOB_NUMBER = ""
parallel_tests = [:]

if (params.PARALLEL == "NodesByIterations") {
childJobNum = NUM_MACHINES
Expand Down Expand Up @@ -249,21 +250,24 @@ 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 = [:]

for (int i = 0; i < childJobNum; i++) {
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 e8802e1

Please sign in to comment.