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

Wrong rendering of dynamically created parallel sequential stages in declarative pipeline

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • blueocean-plugin
    • None
    • Jenkins 2.361, blueocean 1.25.6

      Hello, I'm trying to dynamically generate stages in a declarative pipeline and execute them parallelly. This works up to the point where one such "stage" actually consists of multiple stages which should be run sequentially.

      The following simplified code shows the problem:

      def generateStage(String name) {
          return {
              node {
                  echo "STAGE ${name}"
              }
          }
      }
      
      def generateStages(String name) {
          return {
              node {
                  stage("A") {
                      echo "STAGE ${name} / STAGE A"
                  }
                  
                  stage("B") {
                      echo "STAGE ${name} / STAGE B"
                  }
              }
          }
      }
      
      pipeline {
          agent any
          
          stages {
              stage("Stages") {
                  steps {
                      script {
                          parallel([
                              "ONE": generateStage("ONE"),
                              "TWO": generateStages("TWO")
                          ])
                      }
                  }
              }
          }
      } 

      This pipeline gets visualized as shown in the attached picture (Pipeline.png). In the console output I can see that the "STAGE TWO / STAGE B" echo is there but stage B doesn't appear in the Blue Ocean UI.

      When using the functions in a scripted pipeline the visualization is correct (just parallel(...) instead of pipeline ...). So is that a bug, a missing feature or am I doing something wrong? Thanks in advance. 

       

          [JENKINS-70213] Wrong rendering of dynamically created parallel sequential stages in declarative pipeline

          Mark Waite added a comment -

          Declarative Pipeline does not support dynamically generated stages. Use scripted if the Pipeline needs to be generated dynamically.

          Mark Waite added a comment - Declarative Pipeline does not support dynamically generated stages. Use scripted if the Pipeline needs to be generated dynamically.

            Unassigned Unassigned
            radau Ralf
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: