-
Bug
-
Resolution: Not A Defect
-
Major
-
None
I understood that having nested pipeline {} blocks was not possible.
However I found out now that one cannot run pipeline {} blocks in parallel.
The reason I considered this as a Bug is that these pipeline {} blocks are not "nested" (at least visibly) which is what the documentation says it is not allowed. So this should be allowed accordingly to the documentation.
I marked it as Major as it takes away possibly the major use case of "pipeline templates".
A common sequence of stages that achieves some X result is made into a "pipeline template" for avoiding repeating code (DNRY) and so it can be used with different parameters many times. But having to do this many times SEQUENTIALLY is most of the times impractical as it would make the pipeline execution be too long.
The only workaround would be to repeat the sequence of stages in each parallel block so not using the "pipeline template".
Example: I get a
java.lang.IllegalStateException: Only one pipeline { ... } block can be executed in a single run.
when trying to invoke it on one of the parallel blocks:
(the ettPipeline is a declarative "pipeline template"; only one of it runs perfectly to completion)
try {
stage('Parallel Builds') {
parallel (
Build1: { node {
ettPipeline (
task: "${ETT_TASK}",
pkg: "${ETT_PACKAGE}",
scm_url: "${SCM_URL}",
clentry: "${NOTE}",
email: "${EMAIL}"
)
}},
Build2: { node {
ettPipeline (
task: "${ETT_TASK2}",
pkg: "${ETT_PACKAGE2}",
scm_url: "${SCM_URL2}",
clentry: "${NOTE2}",
email: "${EMAIL}"
)
}},
)
}
}
catch(e)
{ currentBuild.result = "FAILED" throw e }