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

NPE in logInterpolationWarnings after latest changes to DSL.java

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • workflow-cps-plugin
    • None
    • Jenkins 2.263.3 multibranch pipeline
    • 2.90

      We got such NPE witch breaks pipeline which wasn't happening few months ago with older Jenkins versions:

      java.lang.NullPointerException
      at org.jenkinsci.plugins.workflow.cps.DSL.lambda$logInterpolationWarnings$1(DSL.java:379)
      at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
      at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
      at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
      at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipelinhr e.java:472)
      at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
      at org.jenkinsci.plugins.workflow.cps.DSL.logInterpolationWarnings(DSL.java:380)

      ...

       

      the first line which fails is:
      host: 'clamav-${profile == 'pre' ? 'dev.my-namespace.svc.cluster.local' : profile}'

      (i found it by making reply many times removing other lines, but there's more lines that fail).

      profile is just a variable, not even a credentials.

       

      I think the problem is in this commit https://github.com/jenkinsci/workflow-cps-plugin/commit/67045a6dc0f8ea720ef36bb3fa4eb31ac1428e5d#diff-32b19cea17be6f1240f13dbf1705f752422c2ba8e3df105204d37a1961d7fe08R379 maybe envVars.get(e) is null?

       

      I've managed to workaround this with such first line in the step which fails and approve it in Manage Jenkins -> In-process Script Approval:
      org.jenkinsci.plugins.workflow.cps.DSL.UNSAFE_GROOVY_INTERPOLATION = "ignore"

            carroll Carroll Chiou
            denis111 Denis K
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: