I want to run a series of tests on multiple platforms (AIX, pi, macOS, Windows, Linux). Obviously that level can be executed in parallel.
pipeline {
agent any
stages {
stage ("Run Tests") {
steps {
parallel (
pi:{...}
aix: {...}
etc.
But the tests for "pi" can not run on any pi - I am testing against multiple versions of the software and need to select the specific platform per test, so the pi-Test (as well as aix) then goes on:
catchError(buildResult: "UNSTABLE", stageResult: "FAILURE") {
script{
def E="" // define some variables per platform
def res=""
stage ("pi&&Version1") {
agent {
label "pi&&Version1"
}
script {
echo "NODE_NAME = ${env.NODE_NAME}"
...intense code to test V1...
}
}
stage ("pi&&Version2") {
agent {
label "pi&&Version2"
}
script {
echo "NODE_NAME = ${env.NODE_NAME}"
...intense code to test V2...
}
}
}
}
So each test on a platform needs an agent with a specific label which means that the agent is selected "deeper" within the code. And I haven't seen any examples doing this - maybe I read the wrong doc or did not understand it well enough - but I just can't find a way to structure my scripts in a way which would allow me doing this.
The script fails with
Invalid step "stage" used - not allowed in this context - The stage step cannot be used in Declarative Pipelines
Any suggestions how to get this working will be much appreciated.