HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Multiple levels of parallel stages in a Jenkins declarative pipeline

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
declarativejenkinsstagesparallellevelsmultiplepipeline

Problem

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?

Solution

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.

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



  • 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.

Context

StackExchange DevOps Q#6604, answer score: 5

Revisions (0)

No revisions yet.