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

NPE exception on pipeline checkout step (Pipeline multibranch)

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      workflow-scm-step 2.10

      Description

      Multibranch pipeline jobs are failing on git checkout step with the latest versions of pipeline plugins.

      java.lang.NullPointerException at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:836) at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1000(WorkflowRun.java:133) at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1101) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:133) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:91) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:78) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
      

      Multibranch pipeline job does not fail with Pipeline: SCM Step 2.7 version, next versions (2.8, 2.9) leads to fails with NPE.

      This is an example of Jenkinsfile:

       

      pipeline {
        agent none
        options {
          timeout(time: 1, unit: 'HOURS')
          buildDiscarder(logRotator(numToKeepStr: '20'))
          disableConcurrentBuilds()
          timestamps()
        }
        stages {
          stage('Build and publish') {
            agent { label 'environment/qa && java/1.8' } 
            steps {
              git branch: 'test',
                  url: 'git@github.com:yourorganization/yourgit.git'
              sh 'echo test'
            }
          }
        }
      }
      

       

       

        Attachments

          Issue Links

            Activity

            suiside Artem Gryshyn created issue -
            suiside Artem Gryshyn made changes -
            Field Original Value New Value
            Description Multibranch pipeline jobs are failing on git checkout step after update to the latest versions of pipeline plugins. 
            java.lang.NullPointerException
            at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:836)
            at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1000(WorkflowRun.java:133)
            at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1101)
            at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:133)
            at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:91)
            at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:78)
            at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at java.lang.Thread.run(Thread.java:748)
            Finished: FAILURE
            Multibranch pipeline job does not fail with Pipeline: SCM Step 2.7 version, next versions (2.8, 2.9) leads to fails with NPE.

            This is an example of Jenkinsfile:

             
            {code:java}
            pipeline {
              agent none
              options {
                timeout(time: 1, unit: 'HOURS')
                buildDiscarder(logRotator(numToKeepStr: '20'))
                disableConcurrentBuilds()
                timestamps()
              }
              stages {
                stage('Build and publish') {
                  agent { label 'environment/qa && java/1.8' }
                  steps {
                    git branch: 'test',
                        url: 'git@github.com:yourorganization/yourgit.git'
                    sh 'echo test'
                  }
                }
              }
            }
            {code}
             

             
            Multibranch pipeline jobs are failing on git checkout step after update to the latest versions of pipeline plugins. 
             java.lang.NullPointerException
             at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:836)
             at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1000(WorkflowRun.java:133)
             at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1101)
             at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:133)
             at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:91)
             at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:78)
             at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
             at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
             at java.util.concurrent.FutureTask.run(FutureTask.java:266)
             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
             at java.lang.Thread.run(Thread.java:748)
             Finished: FAILURE


             Multibranch pipeline job does not fail with Pipeline: SCM Step 2.7 version, next versions (2.8, 2.9) leads to fails with NPE.

            This is an example of Jenkinsfile:

             
            {code:java}
            pipeline {
              agent none
              options {
                timeout(time: 1, unit: 'HOURS')
                buildDiscarder(logRotator(numToKeepStr: '20'))
                disableConcurrentBuilds()
                timestamps()
              }
              stages {
                stage('Build and publish') {
                  agent { label 'environment/qa && java/1.8' }
                  steps {
                    git branch: 'test',
                        url: 'git@github.com:yourorganization/yourgit.git'
                    sh 'echo test'
                  }
                }
              }
            }
            {code}
             

             
            suiside Artem Gryshyn made changes -
            Description Multibranch pipeline jobs are failing on git checkout step after update to the latest versions of pipeline plugins. 
             java.lang.NullPointerException
             at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:836)
             at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1000(WorkflowRun.java:133)
             at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1101)
             at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:133)
             at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:91)
             at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:78)
             at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
             at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
             at java.util.concurrent.FutureTask.run(FutureTask.java:266)
             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
             at java.lang.Thread.run(Thread.java:748)
             Finished: FAILURE


             Multibranch pipeline job does not fail with Pipeline: SCM Step 2.7 version, next versions (2.8, 2.9) leads to fails with NPE.

            This is an example of Jenkinsfile:

             
            {code:java}
            pipeline {
              agent none
              options {
                timeout(time: 1, unit: 'HOURS')
                buildDiscarder(logRotator(numToKeepStr: '20'))
                disableConcurrentBuilds()
                timestamps()
              }
              stages {
                stage('Build and publish') {
                  agent { label 'environment/qa && java/1.8' }
                  steps {
                    git branch: 'test',
                        url: 'git@github.com:yourorganization/yourgit.git'
                    sh 'echo test'
                  }
                }
              }
            }
            {code}
             

             
            Multibranch pipeline jobs are failing on git checkout step after update to the latest versions of pipeline plugins.
            {code:java}
            java.lang.NullPointerException at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:836) at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1000(WorkflowRun.java:133) at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1101) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:133) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:91) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:78) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
            {code}

            Multibranch pipeline job does not fail with Pipeline: SCM Step 2.7 version, next versions (2.8, 2.9) leads to fails with NPE.

            This is an example of Jenkinsfile:

             
            {code:java}
            pipeline {
              agent none
              options {
                timeout(time: 1, unit: 'HOURS')
                buildDiscarder(logRotator(numToKeepStr: '20'))
                disableConcurrentBuilds()
                timestamps()
              }
              stages {
                stage('Build and publish') {
                  agent { label 'environment/qa && java/1.8' }
                  steps {
                    git branch: 'test',
                        url: 'git@github.com:yourorganization/yourgit.git'
                    sh 'echo test'
                  }
                }
              }
            }
            {code}
             

             
            suiside Artem Gryshyn made changes -
            Component/s workflow-multibranch-plugin [ 21465 ]
            Component/s pipeline-multibranch-defaults-plugin [ 21926 ]
            suiside Artem Gryshyn made changes -
            Assignee Denis Saponenko [ vaimr ]
            suiside Artem Gryshyn made changes -
            Summary Multibranch pipeline checkout NPE exception NPE exception on pipeline checkout step (Pipeline multibranch)
            suiside Artem Gryshyn made changes -
            Description Multibranch pipeline jobs are failing on git checkout step after update to the latest versions of pipeline plugins.
            {code:java}
            java.lang.NullPointerException at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:836) at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1000(WorkflowRun.java:133) at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1101) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:133) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:91) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:78) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
            {code}

            Multibranch pipeline job does not fail with Pipeline: SCM Step 2.7 version, next versions (2.8, 2.9) leads to fails with NPE.

            This is an example of Jenkinsfile:

             
            {code:java}
            pipeline {
              agent none
              options {
                timeout(time: 1, unit: 'HOURS')
                buildDiscarder(logRotator(numToKeepStr: '20'))
                disableConcurrentBuilds()
                timestamps()
              }
              stages {
                stage('Build and publish') {
                  agent { label 'environment/qa && java/1.8' }
                  steps {
                    git branch: 'test',
                        url: 'git@github.com:yourorganization/yourgit.git'
                    sh 'echo test'
                  }
                }
              }
            }
            {code}
             

             
            Multibranch pipeline jobs are failing on git checkout step with the latest versions of pipeline plugins.
            {code:java}
            java.lang.NullPointerException at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:836) at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1000(WorkflowRun.java:133) at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1101) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:133) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:91) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:78) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
            {code}
            Multibranch pipeline job does not fail with Pipeline: SCM Step 2.7 version, next versions (2.8, 2.9) leads to fails with NPE.

            This is an example of Jenkinsfile:

             
            {code:java}
            pipeline {
              agent none
              options {
                timeout(time: 1, unit: 'HOURS')
                buildDiscarder(logRotator(numToKeepStr: '20'))
                disableConcurrentBuilds()
                timestamps()
              }
              stages {
                stage('Build and publish') {
                  agent { label 'environment/qa && java/1.8' }
                  steps {
                    git branch: 'test',
                        url: 'git@github.com:yourorganization/yourgit.git'
                    sh 'echo test'
                  }
                }
              }
            }
            {code}
             

             
            Hide
            dnusbaum Devin Nusbaum added a comment -

            Artem Gryshyn I think this is related to JENKINS-57918, but in that case, it only affected the Repo SCM. I have not heard any other reports from Git users, so maybe there is something special about your case? What version of workflow-job are you running so we can see exactly what line in WorkflowRun is throwing the NPE?

            Feel free to try out https://github.com/jenkinsci/workflow-scm-step-plugin/pull/37 in your dev environment to see if it fixes the problem.

            Show
            dnusbaum Devin Nusbaum added a comment - Artem Gryshyn I think this is related to JENKINS-57918 , but in that case, it only affected the Repo SCM. I have not heard any other reports from Git users, so maybe there is something special about your case? What version of workflow-job are you running so we can see exactly what line in WorkflowRun is throwing the NPE? Feel free to try out https://github.com/jenkinsci/workflow-scm-step-plugin/pull/37 in your dev environment to see if it fixes the problem.
            dnusbaum Devin Nusbaum made changes -
            Link This issue relates to JENKINS-57918 [ JENKINS-57918 ]
            Hide
            suiside Artem Gryshyn added a comment -

            Devin Nusbaum tnx, your changes fixed NPE. I tested my case with multibranch pipeline and single pipeline, nothing has broken.

            Show
            suiside Artem Gryshyn added a comment - Devin Nusbaum tnx, your changes fixed NPE. I tested my case with multibranch pipeline and single pipeline, nothing has broken.
            Hide
            suiside Artem Gryshyn added a comment -

            Devin Nusbaum I'm not sure I get you right, but if you mean Pipeline: Job - version is 2.35

            Show
            suiside Artem Gryshyn added a comment - Devin Nusbaum I'm not sure I get you right, but if you mean Pipeline: Job - version is 2.35
            Hide
            dnusbaum Devin Nusbaum added a comment -

            Artem Gryshyn Yes, sorry, the artifact id of the plugin is workflow-job, but the name shown to users is Pipeline: Job Plugin. What is the GitHub plugin being configured in the attached screenshot (it doesn't look like GitHub Branch Source)? That plugin should probably be updated so that it writes an empty changelog file when there are no changes instead of leaving the changelog file empty for consistency with other SCMs.

            Show
            dnusbaum Devin Nusbaum added a comment - Artem Gryshyn Yes, sorry, the artifact id of the plugin is workflow-job, but the name shown to users is Pipeline: Job Plugin. What is the GitHub plugin being configured in the attached screenshot (it doesn't look like GitHub Branch Source)? That plugin should probably be updated so that it writes an empty changelog file when there are no changes instead of leaving the changelog file empty for consistency with other SCMs.
            Hide
            suiside Artem Gryshyn added a comment -

            Devin Nusbaum this is a https://plugins.jenkins.io/github GitHub plugin, 1.29.4 version. Also used https://plugins.jenkins.io/git Git plugin, 3.12.1 version. 

            Git plugin was downgraded to 3.12.1 from 4.0.0 because of dependency on "Pipeline: SCM" plugin

            Show
            suiside Artem Gryshyn added a comment - Devin Nusbaum this is a  https://plugins.jenkins.io/github  GitHub plugin, 1.29.4 version. Also used  https://plugins.jenkins.io/git  Git plugin, 3.12.1 version.  Git plugin was downgraded to 3.12.1 from 4.0.0 because of dependency on "Pipeline: SCM" plugin
            Hide
            dnusbaum Devin Nusbaum added a comment -

            It looks like the plugin shown in the screenshot is the GitHub Integration Plugin (https://plugins.jenkins.io/github-pullrequest), this config.jelly file in particular. Perhaps this is the problematic code in that plugin, it could return a parser that just doesn't do anything instead of null. My fix in workflow-scm-step should work fine for this particular issue though.

            Show
            dnusbaum Devin Nusbaum added a comment - It looks like the plugin shown in the screenshot is the GitHub Integration Plugin ( https://plugins.jenkins.io/github-pullrequest ), this config.jelly file in particular . Perhaps this  is the problematic code in that plugin, it could return a parser that just doesn't do anything instead of null. My fix in workflow-scm-step should work fine for this particular issue though.
            dnusbaum Devin Nusbaum made changes -
            Remote Link This issue links to "jenkinsci/workflow-scm-step-plugin#37 (Web Link)" [ 24300 ]
            dnusbaum Devin Nusbaum made changes -
            Assignee Devin Nusbaum [ dnusbaum ]
            dnusbaum Devin Nusbaum made changes -
            Component/s github-integration-plugin [ 20620 ]
            Component/s workflow-scm-step-plugin [ 21717 ]
            Component/s workflow-multibranch-plugin [ 21465 ]
            Hide
            suiside Artem Gryshyn added a comment - - edited

            Devin Nusbaum yes, it really does. Since I built plugin with your fix, there are no more NPE exceptions. Interesting thing that NPE is only with multibranch pipeline, single pipeline is not affected. 

            Does your fix going to be implemented and issued with new version of plugin or I have to use my custom build?

            Show
            suiside Artem Gryshyn added a comment - - edited Devin Nusbaum yes, it really does. Since I built plugin with your fix, there are no more NPE exceptions. Interesting thing that NPE is only with multibranch pipeline, single pipeline is not affected.  Does your fix going to be implemented and issued with new version of plugin or I have to use my custom build?
            Hide
            dnusbaum Devin Nusbaum added a comment -

            Artem Gryshyn I would like to add some automated tests before I merge the change, but I will try to get a release out with my fix in the next few weeks. 

            Show
            dnusbaum Devin Nusbaum added a comment - Artem Gryshyn I would like to add some automated tests before I merge the change, but I will try to get a release out with my fix in the next few weeks. 
            Hide
            dnusbaum Devin Nusbaum added a comment -

            A fix for this issue was just release in Pipeline: SCM Step Plugin version 2.10.

            Show
            dnusbaum Devin Nusbaum added a comment - A fix for this issue was just release in Pipeline: SCM Step Plugin version 2.10.
            dnusbaum Devin Nusbaum made changes -
            Released As workflow-scm-step 2.10
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            alwillha Alexander Willhaug made changes -
            Link This issue is related to JENKINS-57985 [ JENKINS-57985 ]
            alwillha Alexander Willhaug made changes -
            Link This issue is related to JENKINS-57985 [ JENKINS-57985 ]

              People

              Assignee:
              dnusbaum Devin Nusbaum
              Reporter:
              suiside Artem Gryshyn
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: