Managed to successfully run integration tests in parallel on the same node and I now I would like to distribute them across different nodes. In the example below I want stages IT 1
and IT 2
to run on different nodes leaving IT 3
to run on the original node. Tried several combinations by using node
as a parent of stage('IT 1')
and node
as a child but I get syntax errors for both. What is the proper syntax to achieve this?
pipeline {
agent { label '!master' }
stages {
stage('Integration Tests') {
parallel {
stage('IT 1 (slow)') {
steps {
sh 'run-it-1.sh'
}
}
stage('IT 2 (slow)') {
steps {
sh 'run-it-2.sh'
}
}
stage('IT 3 (quick)') {
steps {
sh 'run-it-3.sh'
}
}
}
}
}
}
Edit: Using label
instead of node
works for declarative pipelines. Example below:
stage('IT 1 (slow)') {
agent { label '!master' }
steps {
sh 'run-it-1.sh'
}
}