How to write a dynamic declarative pipeline that contains sequential job inside parallel job I'm trying to write a declarative pipeline code that accepts a map and create a pipeline. I can able to achieve sequential stages or parallel stages but facing problems while making a pipeline that contains sequential stages inside parallel stages.

The input data would be Map. Each list in the map should run parallel and the items inside the list corresponding to each key should run in sequentially.

example data : [1:[11,12], 2:[21,22], 3:[31,32]]

Am using Jenkins 2.164.3

The output should be
This was covered in an official blog post when the feature to nest stages inside a parallel block was added.

Here is the example copy-pasted from the blog post.  In this example, the Windows and Linux blocks are run in parallel, but the stages within each block are run sequentially:

pipeline {
    agent none

    stages {
        stage("build and deploy on Windows and Linux") {
            parallel {
                stage("windows") {
                    agent {
                        label "windows"
                    }
                    stages {
                        stage("build") {
                            steps {
                                bat "run-build.bat"
                            }
                        }
                        stage("deploy") {
                            when {
                                branch "master"
                            }
                            steps {
                                bat "run-deploy.bat"
                            }
                        }
                    }
                }

                stage("linux") {
                    agent {
                        label "linux"
                    }
                    stages {
                        stage("build") {
                            steps {
                                sh "./run-build.sh"
                            }
                        }
                        stage("deploy") {
                             when {
                                 branch "master"
                             }
                             steps {
                                sh "./run-deploy.sh"
                            }
                        }
                    }
                }
            }
        }
    }
}


EDIT: I missed that you're trying to do this based on arbitrary input.  If you want to do that, you must use scripted Pipelines (or a script nested in a Declarative Pipeline).  Plain Declarative Pipelines don't support that kind of runtime-defined Pipelines.