| I don't want nest parallel in parallel. My use case is locking a resource for the parallel and sequential stages as a whole:
pipeline {
agent any
stages {
stage('Lock wrapper') {
options {
lock('resource')
}
stages {
stage('Sequential 1') {
steps {
echo "Sequential 1"
}
}
stage('Sequential 2') {
parallel {
stage('Parallel 2a') {
steps {
echo "Parallel 2a"
}
}
}
}
}
}
}
}
But this gives following error: Parallel stages or branches can only be included in a top-level stage. My final pipeline has far more than these stages, so lock of the whole pipeline is not an option. |