<p>Sure it's possible to have nested parallel stages and it works just fine (I've done it before), but the visualization in the web UI is terrible, even with Blue Ocean.  There was even <a href="https://jenkins.io/blog/2018/07/02/whats-new-declarative-piepline-13x-sequential-stages/" rel="noreferrer">an official blog post when this feature was added</a>.</p>

<p>This question has already been asked a couple other times on this site as well, you might be interested in these questions and answers:</p>

<ul>
<li><a href="https://devops.stackexchange.com/questions/5240/jenkins-pipeline-nested-parallel">jenkins pipeline nested parallel</a></li>
<li><a href="https://devops.stackexchange.com/questions/986/how-to-build-a-complex-parallel-jenkins-pipeline">How to build a complex parallel Jenkins pipeline?</a></li>
</ul>

<p>It's not entirely clear to me from the wording of your question if it's a duplicate of those questions or if there are significant differences, so I haven't flagged your question as a duplicate.</p>

CC BY-SA 4.0
2019-03-15T14:23:40.330Z
Hi.  Thanks for your answer.  Frankly I couldn't care less about the Blue Ocean view.  JENKINS-39203 has made Blue Ocean pretty useless.  As for the potential duplicates, the first one is not.  The answer there is a scripted pipeline.  I specifically asked about declarative.  Second potential duplicate's highest rated answer just refers to "Use nested parallel statements. (Thanks @lawnmowerlatte)" which is not really an answer along with a note about BO visualisation which I don't care about.  The second answer there is not really clear to me how/that he's really nesting parallel stages.
Brian
CC BY-SA 4.0
2019-03-14T22:36:23.610Z
2019-03-14T22:36:23.610Z
jayhendren
<p>I need to define a declarative pipeline with multiple levels of parallel stages as such:</p>

<pre><code>1   Prebuild_action1
2   Prebuild_action2
3.1 Build platform_1
4.1   Test1 platform_1
4.2   Test2 platform_1
4.3   Test3 platform_1
3.2 Build platform_2
3.3 Build platform_3
3.4 Build platform_4
</code></pre>

<p>First, 1 should run, then 2 should run, then all of 3.x should run in parallel and when 3.1 is done all 4.x should run in parallel.</p>

<p>It doesn't seem possible for two reasons:
1. There doesn't seem to be any way to have both a stage and a group of parallel stages within a parent stage and it seems that parallel blocks can only be defined at top-level stages so I can't have a parallel block for 3.x and 4.x.</p>

<p>Is there some way to do that I am just not seeing at the moment?</p>

<jenkins><jenkins-pipeline>
Multiple levels of parallel stages in a Jenkins declarative pipeline
Brian
# Multiple levels of parallel stages in a Jenkins declarative pipeline

(Asked by: username_0 on 2019-03-14)

I need to define a declarative pipeline with multiple levels of parallel stages as such:
1   Prebuild_action1
2   Prebuild_action2
3.1 Build platform_1
4.1   Test1 platform_1
4.2   Test2 platform_1
4.3   Test3 platform_1
3.2 Build platform_2
3.3 Build platform_3
3.4 Build platform_4

First, 1 should run, then 2 should run, then all of 3.x should run in parallel and when 3.1 is done all 4.x should run in parallel.
It doesn't seem possible for two reasons:
1. There doesn't seem to be any way to have both a stage and a group of parallel stages within a parent stage and it seems that parallel blocks can only be defined at top-level stages so I can't have a parallel block for 3.x and 4.x.
Is there some way to do that I am just not seeing at the moment?

**Tags:** jenkins, jenkins-pipeline


---

## 1 answers

### Answer by username_1 on 2019-03-14. Score: 5

Sure it's possible to have nested parallel stages and it works just fine (I've done it before), but the visualization in the web UI is terrible, even with Blue Ocean. There was even [an official blog post when this feature was added](https://jenkins.io/blog/2018/07/02/whats-new-declarative-piepline-13x-sequential-stages/).

This question has already been asked a couple other times on this site as well, you might be interested in these questions and answers:

* [jenkins pipeline nested parallel](https://devops.stackexchange.com/questions/5240/jenkins-pipeline-nested-parallel)
* [How to build a complex parallel Jenkins pipeline?](https://devops.stackexchange.com/questions/986/how-to-build-a-complex-parallel-jenkins-pipeline)

It's not entirely clear to me from the wording of your question if it's a duplicate of those questions or if there are significant differences, so I haven't flagged your question as a duplicate.

> **Comments:**
> **username_0**: Hi.  Thanks for your answer.  Frankly I couldn't care less about the Blue Ocean view.  JENKINS-39203 has made Blue Ocean pretty useless.  As for the potential duplicates, the first one is not.  The answer there is a scripted pipeline.  I specifically asked about declarative.  Second potential duplicate's highest rated answer just refers to "Use nested parallel statements. (Thanks @lawnmowerlatte)" which is not really an answer along with a note about BO visualisation which I don't care about.  The second answer there is not really clear to me how/that he's really nesting parallel stages.  

---

