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' }
} 1 Answer
Since Declarative version 1.2, you can directly declare the kind of agent you want to use for each parallel stages :
Not tested this specific use case, but I assume that if you don't declare any agent{} for stage "IT 3", it will be executed on the original node.
Hopefully it helps.
1