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

null parallelStartNode in StandardChunkVisitor.parallelBranchStart()

    XMLWordPrintable

Details

    Description

      With nested parallel branch, parallelStartNode is passed as null. Its supposed to be non-null value, this behavior has consequence of causing NPE.

      public void parallelBranchStart(@Nonnull FlowNode parallelStartNode, @Nonnull FlowNode branchStartNode, @Nonnull ForkScanner scanner) {}
      
      node {
         stage ('test') { 
           echo ('Testing'); 
           parallel nestedBranch: {
             echo 'nested Branch'
             stage('nestedBranchStage') {
               echo 'running nestedBranchStage'
               parallel secondLevelNestedBranch1: {
                 echo 'secondLevelNestedBranch1'
               }
             }
           },
          failFast: false
         } 
      }
      

      Attachments

        Issue Links

          Activity

            svanoort Sam Van Oort added a comment -

            Probably also needs the parallelStartPredicate to be set automatically if not done currently:

            public static Predicate<FlowNode> PARALLEL_START_PREDICATE = new Predicate<FlowNode>() {
                    @Override
                    public boolean apply(FlowNode input)

            {             return input != null && input instanceof StepStartNode && (((StepStartNode) input).getDescriptor().getClass() == ParallelStep.DescriptorImpl.class);         }

                };

            ForkScanner.setParallelStartPredicate(PARALLEL_START_PREDICATE);

            svanoort Sam Van Oort added a comment - Probably also needs the parallelStartPredicate to be set automatically if not done currently: public static Predicate<FlowNode> PARALLEL_START_PREDICATE = new Predicate<FlowNode>() {         @Override         public boolean apply(FlowNode input) {             return input != null && input instanceof StepStartNode && (((StepStartNode) input).getDescriptor().getClass() == ParallelStep.DescriptorImpl.class);         }     }; ForkScanner.setParallelStartPredicate(PARALLEL_START_PREDICATE);
            vivek Vivek Pandey added a comment -

            svanoort I am not setting this predicate, wasn't aware of it. Looking at it, this seems one of default predicate in ForkScanner? Otherwise everyone doing this kind of thing needs to remember to set it up.

            vivek Vivek Pandey added a comment - svanoort I am not setting this predicate, wasn't aware of it. Looking at it, this seems one of default predicate in ForkScanner? Otherwise everyone doing this kind of thing needs to remember to set it up.
            svanoort Sam Van Oort added a comment -

            vivek Due to a new API added to support other work for Step descriptions in flownodes, I've got the ability to set a working default predicate in this case now (requires workflow-cps v 2.26 to work completely though).

            svanoort Sam Van Oort added a comment - vivek Due to a new API added to support other work for Step descriptions in flownodes, I've got the ability to set a working default predicate in this case now (requires workflow-cps v 2.26 to work completely though).
            vivek Vivek Pandey added a comment -

            Thanks svanoort

            vivek Vivek Pandey added a comment - Thanks svanoort
            svanoort Sam Van Oort added a comment -

            vivek A fix for this, among other things, is awaiting your review in https://github.com/jenkinsci/workflow-api-plugin/pull/33

            svanoort Sam Van Oort added a comment - vivek A fix for this, among other things, is awaiting your review in https://github.com/jenkinsci/workflow-api-plugin/pull/33

            Code changed in jenkins
            User: Sam Van Oort
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/graphanalysis/ForkScanner.java
            src/test/java/org/jenkinsci/plugins/workflow/graphanalysis/ForkScannerTest.java
            http://jenkins-ci.org/commit/workflow-api-plugin/96e2c2ed99384a9c9f4fb80cc8f8876d9b225504
            Log:
            Fix a couple forkscanner testcase quirks, and put JENKINS-39839 to bed along with JENKINS-39841

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Van Oort Path: src/main/java/org/jenkinsci/plugins/workflow/graphanalysis/ForkScanner.java src/test/java/org/jenkinsci/plugins/workflow/graphanalysis/ForkScannerTest.java http://jenkins-ci.org/commit/workflow-api-plugin/96e2c2ed99384a9c9f4fb80cc8f8876d9b225504 Log: Fix a couple forkscanner testcase quirks, and put JENKINS-39839 to bed along with JENKINS-39841
            svanoort Sam Van Oort added a comment -

            Fixed with explicit test coverage in workflow-api 2.12

            svanoort Sam Van Oort added a comment - Fixed with explicit test coverage in workflow-api 2.12

            People

              svanoort Sam Van Oort
              vivek Vivek Pandey
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: