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

Single running parallel branch missing parent parallel block.

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None

      When there is a single, running branch of a pipeline, the StandardChunkVisitor doesn't trigger `parallelEnd` or `parallelStart` for it's parent block.

      This works:

      node {
          parallel([
              "A": {
                  stage("Build") {
                      echo("Build A")
                  }
                  stage("Test") {
                      parallel([
                          "A1" : {
                             echo("Test A1")
                          },
                          "A2" : {
                             echo("Test A2")
                          }
                      ])
                  }
              },
              "B": {
                  stage("Build") {
                      echo("Build B")
                  }
                  parallel([
                      "B1" : {
                         echo("Test B1")
                         sleep(60)
                      },
                      "B2" : {
                         echo("Test B2")
                         sleep(60;
                      }
                  ])
              }
          ])
      } 
      

      We get `A<-A1` and `B<-B1,B2`.

      This doesn't:

      node {
          parallel([
              "A": {
                  stage("Build") {
                      echo("Build A")
                  }
                  stage("Test") {
                      parallel([
                          "A1" : {
                             echo("Test A1")
                          },
                          "A2" : {
                             echo("Test A2")
                          }
                      ])
                  }
              },
              "B": {
                  stage("Build") {
                      echo("Build B")
                  }
                  parallel([
                      "B1" : {
                         echo("Test B1")
                         sleep(60)
                      },
                  ])
              }
          ])
      } 
      

      (`B1` becomes a sibling of `A` - `B` is not listed in the graph until the build completes).

      It feels like this would have been reported already, but I can't find an issue - so raising just in case.

      Update:
      More specifically, in the second Pipeline - `parallelBranchEnd/parallelBranchStart` don't get called for `B` whilst the Pipeline is still executing. This is not the case once the pipeline is finished or in the first example.

          [JENKINS-72771] Single running parallel branch missing parent parallel block.

          Tim Brown created issue -
          Tim Brown made changes -
          Description Original: When there is a single, running branch of a pipeline, the StandardChunkVisitor doesn't trigger `parallelEnd` or `parallelStart` for it's parent block.

          This works:
          ```
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                          },
                          "B2" : {
                             echo("Test B2")
                          }
                      ])
                  }
              ])
          }
          ```
          We get `A<-A1` and `B<-B1,B2`.

          This doesn't:
          ```
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                          },
                      ])
                  }
              ])
          }
          ```
          (`B1` becomes a siibling of `A` - `B` is not listed in the graph until the build completes).

          It feels like this would have been reported already, but I can't find an issue - so raising just in case.
          New: When there is a single, running branch of a pipeline, the StandardChunkVisitor doesn't trigger `parallelEnd` or `parallelStart` for it's parent block.

          This works:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                          },
                          "B2" : {
                             echo("Test B2")
                          }
                      ])
                  }
              ])
          }
          {code}

          We get `A<-A1` and `B<-B1,B2`.

          This doesn't:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                          },
                      ])
                  }
              ])
          }
          {code}
          (`B1` becomes a siibling of `A` - `B` is not listed in the graph until the build completes).

          It feels like this would have been reported already, but I can't find an issue - so raising just in case.
          Tim Brown made changes -
          Description Original: When there is a single, running branch of a pipeline, the StandardChunkVisitor doesn't trigger `parallelEnd` or `parallelStart` for it's parent block.

          This works:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                          },
                          "B2" : {
                             echo("Test B2")
                          }
                      ])
                  }
              ])
          }
          {code}

          We get `A<-A1` and `B<-B1,B2`.

          This doesn't:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                          },
                      ])
                  }
              ])
          }
          {code}
          (`B1` becomes a siibling of `A` - `B` is not listed in the graph until the build completes).

          It feels like this would have been reported already, but I can't find an issue - so raising just in case.
          New: When there is a single, running branch of a pipeline, the StandardChunkVisitor doesn't trigger `parallelEnd` or `parallelStart` for it's parent block.

          This works:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                          "B2" : {
                             echo("Test B2")
                             sleep(60;
                          }
                      ])
                  }
              ])
          }
          {code}

          We get `A<-A1` and `B<-B1,B2`.

          This doesn't:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                      ])
                  }
              ])
          }
          {code}
          (`B1` becomes a sibling of `A` - `B` is not listed in the graph until the build completes).

          It feels like this would have been reported already, but I can't find an issue - so raising just in case.
          Tim Brown made changes -
          Description Original: When there is a single, running branch of a pipeline, the StandardChunkVisitor doesn't trigger `parallelEnd` or `parallelStart` for it's parent block.

          This works:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                          "B2" : {
                             echo("Test B2")
                             sleep(60;
                          }
                      ])
                  }
              ])
          }
          {code}

          We get `A<-A1` and `B<-B1,B2`.

          This doesn't:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                      ])
                  }
              ])
          }
          {code}
          (`B1` becomes a sibling of `A` - `B` is not listed in the graph until the build completes).

          It feels like this would have been reported already, but I can't find an issue - so raising just in case.
          New: When there is a single, running branch of a pipeline, the StandardChunkVisitor doesn't trigger `parallelEnd` or `parallelStart` for it's parent block.

          This works:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                          "B2" : {
                             echo("Test B2")
                             sleep(60;
                          }
                      ])
                  }
              ])
          }
          {code}

          We get `A<-A1` and `B<-B1,B2`.

          This doesn't:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                      ])
                  }
              ])
          }
          {code}
          (`B1` becomes a sibling of `A` - `B` is not listed in the graph until the build completes).

          It feels like this would have been reported already, but I can't find an issue - so raising just in case.

          Update:
          More specifically, in the second Pipeline - `pipelineEnd/pipelineStart` don't get called for `B` until the Pipeline has finished executing, but it does in the first example.
          Tim Brown made changes -
          Description Original: When there is a single, running branch of a pipeline, the StandardChunkVisitor doesn't trigger `parallelEnd` or `parallelStart` for it's parent block.

          This works:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                          "B2" : {
                             echo("Test B2")
                             sleep(60;
                          }
                      ])
                  }
              ])
          }
          {code}

          We get `A<-A1` and `B<-B1,B2`.

          This doesn't:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                      ])
                  }
              ])
          }
          {code}
          (`B1` becomes a sibling of `A` - `B` is not listed in the graph until the build completes).

          It feels like this would have been reported already, but I can't find an issue - so raising just in case.

          Update:
          More specifically, in the second Pipeline - `pipelineEnd/pipelineStart` don't get called for `B` until the Pipeline has finished executing, but it does in the first example.
          New: When there is a single, running branch of a pipeline, the StandardChunkVisitor doesn't trigger `parallelEnd` or `parallelStart` for it's parent block.

          This works:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                          "B2" : {
                             echo("Test B2")
                             sleep(60;
                          }
                      ])
                  }
              ])
          }
          {code}

          We get `A<-A1` and `B<-B1,B2`.

          This doesn't:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                      ])
                  }
              ])
          }
          {code}
          (`B1` becomes a sibling of `A` - `B` is not listed in the graph until the build completes).

          It feels like this would have been reported already, but I can't find an issue - so raising just in case.

          Update:
          More specifically, in the second Pipeline - `pipelineEnd/pipelineStart` don't get called for `B` until the Pipeline has finished executing, but it does in the first example.


          ```
          - addChildrenToNode => Assigning parent {id: 7, name: A} to node {id: 10, name: Build}.

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor atomNode

          atomNode => step action: null - class org.jenkinsci.plugins.workflow.cps.actions.ArgumentsActionImpl

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor atomNode

          atomNode => step action: Timing - class org.jenkinsci.plugins.workflow.actions.TimingAction

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor atomNode

          atomNode => step action: Console Output - class org.jenkinsci.plugins.workflow.support.actions.LogStorageAction

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          - parallelBranchEnd => Node {id: 28, name: Sleep, isStage: false, isParallelBranch: false, isSynthetic: false, class: class org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode}.

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          - Add node {id: 28, name: Sleep, isStage: false, isParallelBranch: false, isSynthetic: false, class: class org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode} to currentParallelBranchEnds, size: 2

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          -- handleBlockEndNode => Found Block EndNode {id: 28, name: Sleep, enclosingId: 22}, pushed new childStack to stack {size: 2}.

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor atomNode

          atomNode => step action: null - class org.jenkinsci.plugins.workflow.cps.actions.ArgumentsActionImpl

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor atomNode

          atomNode => step action: Timing - class org.jenkinsci.plugins.workflow.actions.TimingAction

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor atomNode

          atomNode => step action: Console Output - class org.jenkinsci.plugins.workflow.support.actions.LogStorageAction

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          -- parallelBranchStart => Node {id: 22, name: Branch: B1, isStage: false, isParallelBranch: true, isSynthetic: false, class: class org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode, orphaned: false}.

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          -- parallelBranchStart parallelStartNode => Node {id: 28, name: Sleep, isStage: false, isParallelBranch: false, isSynthetic: false, class: class org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode, orphaned: false}.

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          -- Skipping 'captureOrphanParallelBranches' test...

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          - parallelStart => Node {id: 5, name: Execute in parallel : Start, isStage: false, isParallelBranch: false, isSynthetic: false, parents: class org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode (4)}

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          - parallelStart => Adding children '7,22' to Node {id: 5, name: Execute in parallel : Start, isStage: false, isParallelBranch: false, isSynthetic: false, class: class org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode}.
          ```
          Tim Brown made changes -
          Description Original: When there is a single, running branch of a pipeline, the StandardChunkVisitor doesn't trigger `parallelEnd` or `parallelStart` for it's parent block.

          This works:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                          "B2" : {
                             echo("Test B2")
                             sleep(60;
                          }
                      ])
                  }
              ])
          }
          {code}

          We get `A<-A1` and `B<-B1,B2`.

          This doesn't:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                      ])
                  }
              ])
          }
          {code}
          (`B1` becomes a sibling of `A` - `B` is not listed in the graph until the build completes).

          It feels like this would have been reported already, but I can't find an issue - so raising just in case.

          Update:
          More specifically, in the second Pipeline - `pipelineEnd/pipelineStart` don't get called for `B` until the Pipeline has finished executing, but it does in the first example.


          ```
          - addChildrenToNode => Assigning parent {id: 7, name: A} to node {id: 10, name: Build}.

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor atomNode

          atomNode => step action: null - class org.jenkinsci.plugins.workflow.cps.actions.ArgumentsActionImpl

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor atomNode

          atomNode => step action: Timing - class org.jenkinsci.plugins.workflow.actions.TimingAction

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor atomNode

          atomNode => step action: Console Output - class org.jenkinsci.plugins.workflow.support.actions.LogStorageAction

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          - parallelBranchEnd => Node {id: 28, name: Sleep, isStage: false, isParallelBranch: false, isSynthetic: false, class: class org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode}.

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          - Add node {id: 28, name: Sleep, isStage: false, isParallelBranch: false, isSynthetic: false, class: class org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode} to currentParallelBranchEnds, size: 2

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          -- handleBlockEndNode => Found Block EndNode {id: 28, name: Sleep, enclosingId: 22}, pushed new childStack to stack {size: 2}.

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor atomNode

          atomNode => step action: null - class org.jenkinsci.plugins.workflow.cps.actions.ArgumentsActionImpl

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor atomNode

          atomNode => step action: Timing - class org.jenkinsci.plugins.workflow.actions.TimingAction

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor atomNode

          atomNode => step action: Console Output - class org.jenkinsci.plugins.workflow.support.actions.LogStorageAction

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          -- parallelBranchStart => Node {id: 22, name: Branch: B1, isStage: false, isParallelBranch: true, isSynthetic: false, class: class org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode, orphaned: false}.

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          -- parallelBranchStart parallelStartNode => Node {id: 28, name: Sleep, isStage: false, isParallelBranch: false, isSynthetic: false, class: class org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode, orphaned: false}.

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          -- Skipping 'captureOrphanParallelBranches' test...

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          - parallelStart => Node {id: 5, name: Execute in parallel : Start, isStage: false, isParallelBranch: false, isSynthetic: false, parents: class org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode (4)}

          Feb 27, 2024 4:07:59 PM FINEST io.jenkins.plugins.pipelinegraphview.utils.PipelineNodeTreeVisitor dump

          - parallelStart => Adding children '7,22' to Node {id: 5, name: Execute in parallel : Start, isStage: false, isParallelBranch: false, isSynthetic: false, class: class org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode}.
          ```
          New: When there is a single, running branch of a pipeline, the StandardChunkVisitor doesn't trigger `parallelEnd` or `parallelStart` for it's parent block.

          This works:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                          "B2" : {
                             echo("Test B2")
                             sleep(60;
                          }
                      ])
                  }
              ])
          }
          {code}

          We get `A<-A1` and `B<-B1,B2`.

          This doesn't:

          {code:java}
          node {
              parallel([
                  "A": {
                      stage("Build") {
                          echo("Build A")
                      }
                      stage("Test") {
                          parallel([
                              "A1" : {
                                 echo("Test A1")
                              },
                              "A2" : {
                                 echo("Test A2")
                              }
                          ])
                      }
                  },
                  "B": {
                      stage("Build") {
                          echo("Build B")
                      }
                      parallel([
                          "B1" : {
                             echo("Test B1")
                             sleep(60)
                          },
                      ])
                  }
              ])
          }
          {code}
          (`B1` becomes a sibling of `A` - `B` is not listed in the graph until the build completes).

          It feels like this would have been reported already, but I can't find an issue - so raising just in case.

          Update:
          More specifically, in the second Pipeline - `parallelBranchEnd/parallelBranchStart` don't get called for `B` whilst the Pipeline is still executing. This is not the case once the pipeline is finished or in the first example.

          Tim Jacomb added a comment -

          (jglick / Devin (can't find his jira name) appear to be the maintainer)

          This came from https://github.com/jenkinsci/pipeline-graph-view-plugin/pull/285

          Tim Jacomb added a comment - ( jglick / Devin (can't find his jira name) appear to be the maintainer) This came from https://github.com/jenkinsci/pipeline-graph-view-plugin/pull/285
          Jesse Glick made changes -
          Assignee Original: Sam Van Oort [ svanoort ]

          Jesse Glick added a comment -

          dnusbaum that is

          Jesse Glick added a comment - dnusbaum that is

          Devin Nusbaum added a comment - - edited

          IMO, ForkScanner and related APIs like ChunkFinder are just fundamentally broken for non-trivial cases, particularly when used on incomplete builds, and should be avoided. I would also probably avoid pipeline-graph-analysis in general in newly written code.

          Instead, I would use DepthFirstScanner as mentioned in https://github.com/jenkinsci/workflow-api-plugin/pull/306.

          To elaborate, I found a few serious issues last year while trying to make ForkScanner work with a proprietary Pipeline visualization I worked on (see the video on https://docs.cloudbees.com/docs/cloudbees-ci/latest/pipelines/cloudbees-pipeline-explorer-plugin, timestamp roughly 2:08 shows the relevant functionality), including https://github.com/jenkinsci/workflow-api-plugin/pull/287, https://github.com/jenkinsci/workflow-api-plugin/pull/302 (that might be the case in the description here), and https://github.com/jenkinsci/workflow-api-plugin/pull/305. Maybe with enough time, someone could find a way to make things work in all of the edge cases, but for me it was just way simpler to use DepthFirstScanner directly to avoid all of the problems.

          The core logic in FlowGraphTable might be useful as a starting point just to show you how to build up a basic tree, but would need to be adapted for your specific use case (e.g. filtering out stuff besides stage, parallel, and parallel branches).

          Devin Nusbaum added a comment - - edited IMO, ForkScanner and related APIs like ChunkFinder are just fundamentally broken for non-trivial cases, particularly when used on incomplete builds, and should be avoided. I would also probably avoid pipeline-graph-analysis in general in newly written code. Instead, I would use DepthFirstScanner as mentioned in https://github.com/jenkinsci/workflow-api-plugin/pull/306 . To elaborate, I found a few serious issues last year while trying to make ForkScanner work with a proprietary Pipeline visualization I worked on (see the video on https://docs.cloudbees.com/docs/cloudbees-ci/latest/pipelines/cloudbees-pipeline-explorer-plugin , timestamp roughly 2:08 shows the relevant functionality), including https://github.com/jenkinsci/workflow-api-plugin/pull/287 , https://github.com/jenkinsci/workflow-api-plugin/pull/302 (that might be the case in the description here), and https://github.com/jenkinsci/workflow-api-plugin/pull/305 . Maybe with enough time, someone could find a way to make things work in all of the edge cases, but for me it was just way simpler to use DepthFirstScanner directly to avoid all of the problems. The core logic in FlowGraphTable might be useful as a starting point just to show you how to build up a basic tree, but would need to be adapted for your specific use case (e.g. filtering out stuff besides stage , parallel , and parallel branches).

            Unassigned Unassigned
            canuck1987 Tim Brown
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: