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

Builds failing because Run defining the context within which to find P4 credential is null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core, p4-plugin
    • None
    • Jenkins Server: Windows Server 2012 R2 (x86)
      Slave Node: Linux CentOS 7 (amd64) (virtual machine)
      Jenkins 2.219
      P4 Plugin 1.10.9

      After an upgrade from Jenkins version 2.214 to 2.219, 2 of my Jenkins builds always fail within a few seconds and show the following stack trace:

      FATAL: null
      java.lang.NullPointerException
      at java.util.Objects.requireNonNull(Unknown Source)
      at com.cloudbees.plugins.credentials.CredentialsProvider.findCredentialById(CredentialsProvider.java:873)
      at org.jenkinsci.plugins.p4.client.ConnectionHelper.findCredential(ConnectionHelper.java:917)
      at org.jenkinsci.plugins.p4.tagging.TagAction.getTicket(TagAction.java:218)
      at org.jenkinsci.plugins.p4.build.P4EnvironmentContributor.buildEnvironment(P4EnvironmentContributor.java:89)
      at org.jenkinsci.plugins.p4.build.P4EnvironmentContributor.buildEnvironment(P4EnvironmentContributor.java:32)
      at org.jenkinsci.plugins.p4.PerforceScm.buildEnvironment(PerforceScm.java:727)
      at hudson.scm.SCM.buildEnvVars(SCM.java:554)
      at org.jenkinsci.plugins.p4.PerforceScm.buildEnvVars(PerforceScm.java:719)
      at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:871)
      at org.jenkinsci.plugins.p4.tasks.AbstractTask.setEnvironment(AbstractTask.java:92)
      at org.jenkinsci.plugins.p4.PerforceScm.checkout(PerforceScm.java:514)
      at hudson.scm.SCM.checkout(SCM.java:505)
      at hudson.model.AbstractProject.checkout(AbstractProject.java:1206)
      at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
      at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
      at hudson.model.Run.execute(Run.java:1853)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:428)
      Recording test results
      ERROR: Build step failed with exception
      java.lang.NullPointerException
      at java.util.Objects.requireNonNull(Unknown Source)
      at com.cloudbees.plugins.credentials.CredentialsProvider.findCredentialById(CredentialsProvider.java:873)
      at org.jenkinsci.plugins.p4.client.ConnectionHelper.findCredential(ConnectionHelper.java:917)
      at org.jenkinsci.plugins.p4.tagging.TagAction.getTicket(TagAction.java:218)
      at org.jenkinsci.plugins.p4.build.P4EnvironmentContributor.buildEnvironment(P4EnvironmentContributor.java:89)
      at org.jenkinsci.plugins.p4.build.P4EnvironmentContributor.buildEnvironment(P4EnvironmentContributor.java:32)
      at org.jenkinsci.plugins.p4.PerforceScm.buildEnvironment(PerforceScm.java:727)
      at hudson.scm.SCM.buildEnvVars(SCM.java:554)
      at org.jenkinsci.plugins.p4.PerforceScm.buildEnvVars(PerforceScm.java:719)
      at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:871)
      at hudson.tasks.junit.JUnitResultArchiver.parseAndAttach(JUnitResultArchiver.java:165)
      at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:154)
      at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
      at hudson.model.Build$BuildExecution.post2(Build.java:186)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
      at hudson.model.Run.execute(Run.java:1878)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:428)
      Build step 'Publish JUnit test result report' marked build as failure
      ERROR: Build step failed with exception
      java.lang.NullPointerException
      at java.util.Objects.requireNonNull(Unknown Source)
      at com.cloudbees.plugins.credentials.CredentialsProvider.findCredentialById(CredentialsProvider.java:873)
      at org.jenkinsci.plugins.p4.client.ConnectionHelper.findCredential(ConnectionHelper.java:917)
      at org.jenkinsci.plugins.p4.tagging.TagAction.getTicket(TagAction.java:218)
      at org.jenkinsci.plugins.p4.build.P4EnvironmentContributor.java:89)
      at org.jenkinsci.plugins.p4.build.P4EnvironmentContributor.buildEnvironment(P4EnvironmentContributor.java:32)
      at org.jenkinsci.plugins.p4.PerforceScm.buildEnvironment(PerforceScm.java:727)
      at hudson.scm.SCM.buildEnvVars(SCM.java:554)
      at org.jenkinsci.plugins.p4.PerforceScm.buildEnvVars(PerforceScm.java:719)
      at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:871)
      at hudson.tasks.Mailer.perform(Mailer.java:147)
      at hudson.tasks.Mailer.perform(Mailer.java:138)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
      at hudson.model.Build$BuildExecution.post2(Build.java:186)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
      at hudson.model.Run.execute(Run.java:1878)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:428)
      Build step 'E-mail Notification' marked build as failure
      Finished: FAILURE

      I have never seen this failure before and nothing has been changed on the machine on which Jenkins runs these 2 builds, nor has anything been changed on Jenkins except for the version upgrade. Furthermore, the 2 other builds that run on that machine still work normally.

      In GitHub, I had looked at the code the stack trace refers to. I looked at CredentialsProvider at https://github.com/jenkinsci/credentials-plugin/blob/master/src/main/java/com/cloudbees/plugins/credentials/CredentialsProvider.java , as this is what the 2nd line of the stack trace refers to. The problem is that the "Run defining the context within which to find the credential" is null. The 4th line of the stack trace is P4BaseCredentials auth = ConnectionHelper.findCredential(credential, getRun()); which can be found at https://github.com/jenkinsci/p4-plugin/blob/master/src/main/java/org/jenkinsci/plugins/p4/tagging/TagAction.java . The getRun() method is that in the super class, https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/AbstractScmTagAction.java. However, the stack trace does not show me what code is setting this class's "run" variable.

      The P4 Plugin version is 1.10.9; this had been upgraded from 1.10.6. However, I do not know when this upgrade was made.

            Unassigned Unassigned
            jenkinsuser1 Annie Chen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: