pipeline {
agent any
stages {
stage('Test') {
agent { label 'nodes' }
steps {
sh ''' # code to run tests '''
}
}
stage('Deploy') {
when {
branch 'master'
}
agent { label 'specific-node' }
steps {
sh ''' # code to deploy '''
}
}
}
The "when" condition is being evaluated on 'specific-node' and causes a bottleneck, instead of being evaluated on the master, or on the node that ran the previous stage.