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

Create way for pipeline graph analysis to return full nested structures


      As a consumer of pipeline graph analysis it would be helpful to have a way to get the full block chunk structure (with nesting). This is useful for cases where we need to find the properties of a FlowNode based on block contents (example its label, or the node used to run it).

      In cases where we need scope, we may have nested blocks with following nodes belonging to the enclosing parent block.

      This needs:

      • A SimpleChunkVisitor implementation using an ArrayDeque to store the context (open and nested chunks). If finished with a current chunk (popping out of the scope & removing from ArrayDeque), it is added as a nested chunk in the parent scope, when hitting the ChunkStart
      • A NestableMemoryFlowChunk that can have other chunks added within it or contain lists of nodes nodes.
      • NestableMemoryFlowChunk needs something like "addChunk(NestableMemoryFlowChunk)" and "addNode(FlowNode)".
      • Two container types, RecursiveNestableMemoryFlowChunk has a list of FlowChunk, ContainerNestableMemoryFlowChunk has an ArrayList of flownodes, and is converted to recursive when you add the first nested chunk
      • I've described this as the DOMLike model – this is because you might provide tree-traversal APIs
      • AdvancedVisitor is one way to collect these data models (and couple to datastructures for custom storage). it would invoke a factory to create chunks implementing these interfaces and store data.

            svanoort Sam Van Oort
            svanoort Sam Van Oort
            0 Vote for this issue
            3 Start watching this issue