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

NullPointerException when starting a pipeline in a multibranch project

      java.lang.NullPointerException
       at org.jenkinsci.plugins.p4.scm.StreamsScmSource.getWorkspace(StreamsScmSource.java:67)
       at org.jenkinsci.plugins.p4.PerforceScm.<init>(PerforceScm.java:190)
       at org.jenkinsci.plugins.p4.scm.P4SCMHead.getScm(P4SCMHead.java:34)
       at org.jenkinsci.plugins.p4.scm.P4SCMBuilder.build(P4SCMBuilder.java:55)
       at org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource.build(AbstractP4ScmSource.java:193)
       at org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource.build(AbstractP4ScmSource.java:47)
       at jenkins.scm.api.SCMFileSystem$Builder.build(SCMFileSystem.java:546)
       at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:303)
       at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:100)
       at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293)
       at hudson.model.ResourceController.execute(ResourceController.java:97)
       at hudson.model.Executor.run(Executor.java:429)
       Finished: FAILURE

       
      After updating to 1.9.5 and launching a build (any). Building works fine after reverting to 1.8.15 - which is the last version of the P4 plugin that has worked for us.
       
       

          [JENKINS-55214] NullPointerException when starting a pipeline in a multibranch project

          Paul Allen added a comment -

          It seems that the Path is invalid? I didn't think that was possible...

          Please can you provide some detail to help us reproduce the issue.
          (1) I presume you are using 'Helix Streams' for the source?
          (2) Do you use a custom name or location for your Jenkinsfile
          (3) Is your Jenkinsfile 'Pipeline' (Declarative) or 'node' (Script)?
          (4) Do you use Libraries
          (5) Do you use 'p4sync' or 'checkout' steps in the Jenkinsfile
          (6) When referring to 'Starting a pipeline in a MultiBranch project' do you simply mean clicking on 'Scan Multibranch Pipeline Now' or some other feature?

          Paul Allen added a comment - It seems that the Path is invalid? I didn't think that was possible... Please can you provide some detail to help us reproduce the issue. (1) I presume you are using 'Helix Streams' for the source? (2) Do you use a custom name or location for your Jenkinsfile (3) Is your Jenkinsfile 'Pipeline' (Declarative) or 'node' (Script)? (4) Do you use Libraries (5) Do you use 'p4sync' or 'checkout' steps in the Jenkinsfile (6) When referring to 'Starting a pipeline in a MultiBranch project' do you simply mean clicking on 'Scan Multibranch Pipeline Now' or some other feature?

          Paul Allen added a comment -

          (7) Do you use any variables e.g. ${streams}?

          Paul Allen added a comment - (7) Do you use any variables e.g. ${streams}?

          kyle ian added a comment -

          Ran into this today on 1.9.7 - it appeared to me the cause was a poorly formed parameter block passed to the (node) pipeline on one of my branches.

          • Added new description to parameter on one branch, missing comma after description (groovy linter would've picked it up)
          • All builds under multi pipeline failed with error noted in OP when solely one of the multipipeline branches had bad parameter configuration
          • fixed comma on bad branch parameter configuration (single branch), rescanned multipipeline
          • reran pipeline build for each branch, confirmed fixing that parameter block to be well formed resulted in all successful pipeline builds for each branch

          I have not been able to reproduce it after fixing this parameter block // have not tried breaking it again.

          kyle ian added a comment - Ran into this today on 1.9.7 - it appeared to me the cause was a poorly formed parameter block passed to the (node) pipeline on one of my branches. Added new description to parameter on one branch, missing comma after description (groovy linter would've picked it up) All builds under multi pipeline failed with error noted in OP when solely one of the multipipeline branches had bad parameter configuration fixed comma on bad branch parameter configuration (single branch), rescanned multipipeline reran pipeline build for each branch, confirmed fixing that parameter block to be well formed resulted in all successful pipeline builds for each branch I have not been able to reproduce it after fixing this parameter block // have not tried breaking it again.

          Karl Wirth added a comment -

          Hi kian, thanks for the update. Do you have a rough example that you think caused the problem that you could share?

          Karl Wirth added a comment - Hi kian , thanks for the update. Do you have a rough example that you think caused the problem that you could share?

          kyle ian added a comment - - edited

          p4karl

          Steps I took while investigating:

             1. Updated `description` to have comma after value - all sibiling pipelines still failed with NPE
             2. Removed `ParameterDefinitionProperty` from pipeline props entirely - offending pipeline ran successfully without prop with no NPE, sibiling pipelines failed with NPE still
             3. Added parameterDefinitionProperty back, removing redundant `name`
             4. Rescanned multibranch pipeline after (3)
             5. All sibiling multibranch pipelines run successfully without NPE

          Example:

          properties([
            pipelineTriggers([p4Trigger()]),
            [$class: 'ParametersDefinitionProperty',
              parameterDefinitions:
              [
                [$class: 'hudson.model.BooleanParameterDefinition',
                 name: 'I_AM_A_BOOL_PARAMETER_NAME',
                 name: 'I_AM_AN_UNNECESSARY_REDUNDANT_BOOL_PARAMETER_NAME',
                 description: 'I am a description that is missing a comma after my string ends, which will be detected by linting on a given branchs pipeline, but other pipelines belonging to the same parent multibranch pipeline will fail with JENKINS-55214 NPE until this is corrected.'
                 defaultValue: false]
              ]
            ]
          ])
          
          

           

          kyle ian added a comment - - edited p4karl Steps I took while investigating:    1. Updated `description` to have comma after value - all sibiling pipelines still failed with NPE    2. Removed `ParameterDefinitionProperty` from pipeline props entirely - offending pipeline ran successfully without prop with no NPE, sibiling pipelines failed with NPE still    3. Added parameterDefinitionProperty back, removing redundant `name`    4. Rescanned multibranch pipeline after (3)    5. All sibiling multibranch pipelines run successfully without NPE Example: properties([ pipelineTriggers([p4Trigger()]), [$class: 'ParametersDefinitionProperty' , parameterDefinitions: [ [$class: 'hudson.model.BooleanParameterDefinition' , name: 'I_AM_A_BOOL_PARAMETER_NAME' , name: 'I_AM_AN_UNNECESSARY_REDUNDANT_BOOL_PARAMETER_NAME' , description: 'I am a description that is missing a comma after my string ends, which will be detected by linting on a given branchs pipeline, but other pipelines belonging to the same parent multibranch pipeline will fail with JENKINS-55214 NPE until this is corrected.' defaultValue: false ] ] ] ])  

          Paul Allen added a comment -

          Closing.  Plugin cannot read invalid pipeline script.

          Paul Allen added a comment - Closing.  Plugin cannot read invalid pipeline script.

            p4karl Karl Wirth
            gpetit Gaspard Petit
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: