Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-60324

nested Parallel in declarative results in temporary misrendering

XMLWordPrintable

      We're using a declarative pipeline that happens to use

      def {}
      // and
      script {} 
      // and
      parallel objects
      def projectName(projectPrefix, flavor) {
          return "${projectPrefix} ${flavor}"
      }
      def templateProjectNode (project, flavor, publish) {
          return {
              node {
                  stage(projectName(project, flavor)) {
                      try {
                          sh "hostname"
                          script {
                              sh label: "Compile + Test + Publish", script: "hostname"
                          }
                      }
                      finally {
                          junit "*/target/test-reports/**/*.xml"
                          archiveArtifacts "*/target/test-reports/**"
                          archiveArtifacts "*/target/*/*report/**"
                      }
                  }
              }
           }
      }
      def generateProjects (projectList) {
          def projects = projectList.collectEntries {
              [(projectName(it[0], it[1])): templateProjectNode(it[0], it[1], it[2])]
          }
          parallel projects
      }
      
      pipeline {
          stages {
              stage("a") {
                  steps {
                      sh "hostname"
                  }
              }
              stage("b") {
                  steps {
                      sh "hostname"
                  }
              }
              stage("c") {
                  steps {
                      sh "hostname"
                  }
              }
              stage("Compile + Test + Publish") {
                  parallel {
                      stage("Frontend") {
                          steps {
                              sh "hostname"
                          }
                      }
                      stage("Magic") {
                          steps {
                              script {
                                  projectList = [
                                      ["D", "QQ", true],
                                      ["D", "RR", true],
                                      ["E", "QQ", true],
                                      ["F", "QQ", true],
                                      ["F", "RR", true],
                                      ["G", "QQ", true],
                                      ["H", "QQ", false],
                                  ]
                                  generateProjects(projectList)
                              }
                          }
                      }
                  }
              }
              stage("j") {
                  steps {
                      sh "hostname"
                  }
              }
              stage("k") {
                  steps {
                      sh "hostname"
                  }
              }
              stage("l") {
                  when {
                      branch "master"
                  }
                  steps {
                      sh "hostname"
                  }
              }
          }
      }
       

       

      Expected results:

      the graph should generally have the same shape as the final graph. The first graph is perhaps the most problematic, although the second is also wrong.

        1. image-2019-11-28-15-13-12-961.png
          94 kB
          Josh Soref
        2. image-2019-11-28-15-13-20-794.png
          83 kB
          Josh Soref
        3. image-2019-11-28-15-13-25-702.png
          100 kB
          Josh Soref

            Unassigned Unassigned
            jsoref Josh Soref
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: