I'm trying to connect to couple of my Jenkins slaves and run simple command on each of them. This Jenkinsfile code works fine:
pipeline {
agent none
stages {
stage('alexander') {
agent { label 'alexanderPig' }
steps {
sh "uptime"
}
}
stage('freddy') {
agent { label 'freddyFox' }
steps {
sh "uptime"
}
}
}
}
But what if I had 20 slaves? Is there a way to define an array of agents and then simply run sh commands once inside ie. a loop?
Regards!