With Jenkins declarative syntax, it's possible to run parallel stages with no top-level agent. This ends up consuming two executors, since the top level agent is marked 'none':
pipeline {
agent none
stages {
stage('Run on parallel nodes') {
parallel {
stage('Do one thing') {
agent any
steps {
...
}
stage('Do another thing') {
agent any
steps {
...
}
}
}
}
}
}
With scripted pipelines, which requires a top-level 'node' element, this is seemingly not possible. This ends up consuming three executors, even though only two are doing real work:
node {
stage('Run on parallel nodes') {
parallel ([
'Do one thing': {
node() {
...
}
},
'Do another thing': {
node() {
...
}
}
])
}
}
Is a 'lightweight' top level executor possible with scripted pipelines?