-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
CloudBees Core Managed Master 2.204.3.7
Apologies if this is a duplicate, but I couldn't find another ticket.
I'd like to create a job that runs a standalone stage, and a matrix based stage, in parallel. Below is an example of what I'm thinking. The AWS job has different steps / params, so it would be run in parallel to the matrix build, which has several more variants.
When running the below, the build stops, and tells me `"matrix" or "parallel" cannot be nested inside another "matrix" or "parallel"`.
stage('Build Images') { parallel { stage ('Build AWS') { steps { echo "Running AWS Clone Packer Job" sh 'doing stuff' } } stage('Build vCenter') { matrix { axes { axis { name 'DC' values 'DC1', 'DC2' } axis { name 'DB' values 'DB1', 'DB2' } axis { name 'TENNANTS' values 'ST', 'MT' } } } steps { echo "Running vCenter Clone Packer Job" sh "doing something in a matrix" } } } }
- relates to
-
JENKINS-68638 Second level parallel steps not visualized correctly
-
- Open
-
The documentation explicitly mentions this limitation: "It is not possible to nest a parallel or matrix block within a stage directive if that stage directive is nested within a parallel or matrix block itself." (https://www.jenkins.io/doc/book/pipeline/syntax/#declarative-matrix).
I guess it was left out when adding "matrix" for some good reason. Not that I'm planning to work on this, but maybe it could help somebody else if there were an explanation of the main challenges to implement this (AFAICS bitwiseman implemented the matrix support).
People is doing really interesting stuff to overcome this limitation (e.g. https://stackoverflow.com/questions/63878233/running-non-matrix-stages-in-parallel-to-a-matrix-in-jenkins-declarative-pipelin).