Calculate total runtime of a CI/CD pipeline across sequential and parallel stages.
Total CI/CD pipeline runtime is the sum of every stage that must run sequentially, plus the duration of the slowest stage within any parallel group (since parallel stages complete together, bounded by whichever one takes longest): total = sum(sequential_stages) + max(parallel_group_stages). Queue delay waiting for an available executor adds on top of the pipeline's own execution time.
totalRuntime = sum(sequentialStages) + max(parallelGroupStages) + queueDelay
Stages running in parallel execute concurrently on separate executors, so the group as a whole only takes as long as its slowest member — the faster stages simply finish early and wait.
Moving a slow, independent stage (e.g. a lengthy test suite) into its own parallel group alongside other independent stages reduces total pipeline time by removing it from the sequential sum, at the cost of using another executor concurrently.
Yes — on shared CI infrastructure during peak hours, queue delay can exceed the pipeline's own execution time; provisioning more executors or using ephemeral cloud runners reduces this variability.
Compute each parallel group's max independently, then add all of them plus the sequential stage sum for the full pipeline duration.