Hi,
I am a new Jenkins Pipeline user.
I want to use Jenkins pipeline to run my regression tests.
For simplification, I want to run 2 tests on same node (agent) in parallel.
My pipeline script has a stage that looks like:
...
stage ('runParallel') {
node ('regrNode') {
def testsuites = ['smokeTestONE', 'smokeTestTWO']
def runTSClosure = { testsuite ->
sh "echo RUNNING $testsuite testsuite"
}
echo "DEBUG... testsuites: " + testsuites
def parallelBuilders = parallelTestsBuilder5(testsuites, runTSClosure)
echo "DEBUG... parallelBuilders " + parallelBuilders
parallel parallelBuilders
}
}
...
I have a parallelTestsBuilder5 in my Global Shared Library, defined as follows:
@NonCPS
def call(tsArr, Closure body) {
def tsArray = tsArr
def builders = [:]
tsArray.each {
def test = it
builders[test] = {
body(test)
}
}
return builders
}
---
When I ran my pipeline, I got:
[Pipeline] echo
DEBUG... testsuites: [smokeTestONE, smokeTestTWO]
[Pipeline] echo
DEBUG... parallelBuilders [smokeTestONE:parallelTestsBuilder5$_call_closure1$_closure2@56786875, smokeTestTWO:parallelTestsBuilder5$_call_closure1$_closure2@6d9351cc]
[Pipeline] parallel
[Pipeline] [smokeTestONE] { (Branch: smokeTestONE)
[Pipeline] [smokeTestTWO] { (Branch: smokeTestTWO)
[Pipeline] [smokeTestONE] sh
[smokeTestONE] [runRegressionParallel3.1] Running shell script
[smokeTestONE] + echo RUNNING smokeTestTWO testsuite
[smokeTestONE] RUNNING smokeTestTWO testsuite
[Pipeline] [smokeTestTWO] sh
[smokeTestTWO] [runRegressionParallel3.1] Running shell script
[Pipeline] }
[smokeTestTWO] + echo RUNNING smokeTestTWO testsuite
[smokeTestTWO] RUNNING smokeTestTWO testsuite
====
QUESTION:
Why am I getting the following?
[smokeTestONE] + echo RUNNING smokeTestTWO testsuite
[smokeTestONE] RUNNING smokeTestTWO testsuite
=> I am expecting:
[smokeTestONE] + echo RUNNING smokeTestONE testsuite
[smokeTestONE] RUNNING smokeTestONE testsuite
Let me know what I did wrong.
Thanks,
Lina