I am using declarative pipeline and in some of my stages, i need to use multiple agents while still ensuring the steps are executed in sequence (not parallel). I don't find a nice way to use multiple agents (maybe multiple steps) within a stage.
something like: pipeline { agent none stages { stage ('prepare') { agent any steps { script { echo "somrthing" } } } stage('Build') { agent { label 'master' } steps { echo 'on master' } agent { label 'slave1'} steps { echo 'on slave' } } } } Since this is not supported, i am forced to use a less elegant way: pipeline { agent none stages { stage ('prepare') { agent any steps { script { echo "somrthing" } } } stage('Build') { agent { label 'master' } steps { echo 'on master' executeOnSlave() } } } } def executeOnSlave() { node ('slave1') { echo 'on slave' } } -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f33c6976-e02a-4acd-9d63-166c9120291f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.