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

NPE using cached pipeline shared libraries

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • Jenkins 2.289.2, workflow-cps-global-lib 2.21
      Configured to cache global pipeline library access
    • 545.v7b28cce323cf

      I've configured my global pipeline libraries to be cached as described https://github.com/MarkEWaite/docker-lfs/blob/bb6c6709ea92b97431e14fffaf0026407175b04a/ref/jenkins.yaml#L313 . When that caching is enabled, one of my pipelines fails with a null pointer exception message like this:

      19:49:51  java.lang.NullPointerException
      19:49:51  	at org.jenkinsci.plugins.workflow.libs.LibraryCachingConfiguration.getExcludedVersions(LibraryCachingConfiguration.java:48)
      19:49:51  	at org.jenkinsci.plugins.workflow.libs.LibraryCachingConfiguration.isExcluded(LibraryCachingConfiguration.java:52)
      19:49:51  	at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:163)
      19:49:51  	at org.jenkinsci.plugins.workflow.libs.LibraryAdder.add(LibraryAdder.java:138)
      19:49:51  	at org.jenkinsci.plugins.workflow.libs.LibraryDecorator$1.call(LibraryDecorator.java:125)
      19:49:51  	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065)
      19:49:51  	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
      19:49:51  	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
      19:49:51  	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
      19:49:51  	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
      19:49:51  	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
      19:49:51  	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
      19:49:51  	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
      19:49:51  	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
      19:49:51  	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
      19:49:51  	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:571)
      19:49:51  	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:523)
      19:49:51  	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:337)
      19:49:51  	at hudson.model.ResourceController.execute(ResourceController.java:97)
      19:49:51  	at hudson.model.Executor.run(Executor.java:429)
      

      If I set a non-empty string in the global pipeline library caching values, it seems to avoid the null pointer exception.

      Pull request build result to review

      If you would like to test this fix and are using plugins.txt to configure your Jenkins plugin installations, add the following line to plugins.txt:

      workflow-cps-global-lib:incrementals;org.jenkins-ci.plugins.workflow;2.22-rc541.14bc6519743f
      

            Unassigned Unassigned
            markewaite Mark Waite
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: