Reputation: 1220
In the Pipeline scripted syntax we use this syntax to declare specific steps to specific nodes:
steps{
node('node1'){
// sh
}
node('node2'){
// sh
}
}
But I want to use the Pipeline Declarative Syntax, can I put many agents?
Upvotes: 3
Views: 857
Reputation: 8284
Sure you can. Just take a look at example (from docs):
pipeline {
agent none
stages {
stage('Build') {
agent any
steps {
checkout scm
sh 'make'
stash includes: '**/target/*.jar', name: 'app'
}
}
stage('Test on Linux') {
agent {
label 'linux'
}
steps {
unstash 'app'
sh 'make check'
}
post {
always {
junit '**/target/*.xml'
}
}
}
stage('Test on Windows') {
agent {
label 'windows'
}
steps {
unstash 'app'
bat 'make check'
}
post {
always {
junit '**/target/*.xml'
}
}
}
}
}
Upvotes: 4