The solution was to use a node, instead of a stage.
def stagesMap = [:]
for (int i = 1; i < 3; i++) {
stagesMap[testName] = {
node('nodeNameOrLabel') { //use node here instead of stage.
script {
someFunctionCall()
}
}
}
}
parallel stagesMap