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

[Pipeline] Some non-CPS transformable code will not throw errors

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Component/s: workflow-cps-plugin
    • Labels:
      None
    • Environment:
      CloudBees Jenkins Enterprise 2.7.19.1-rolling
      Workflow CPS plugin 2.23
    • Similar Issues:

      Description

      The groovy cps documentation does warn that some loop constructs are not cps transformable.
      However, when they are used, they will behave incorrectly (and silently) rather than throwing an error.

      repro case

      println (["dog", "cat"].findAll{it.contains("dog")})
      

      In a regular groovy shell, this will return ["dog"], as you would expect. In a pipeline job, this will return true.

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            In a fresh 2.7.19.1 instance:

            Started by user admin
            [Pipeline] End of Pipeline
            java.lang.UnsupportedOperationException: Calling public static java.util.List org.codehaus.groovy.runtime.DefaultGroovyMethods.findAll(java.util.List,groovy.lang.Closure) on a CPS-transformed closure is not yet supported (JENKINS-26481); encapsulate in a @NonCPS method, or use Java-style loops
            	at org.jenkinsci.plugins.workflow.cps.GroovyClassLoaderWhitelist.checkJenkins26481(GroovyClassLoaderWhitelist.java:86)
            	at org.jenkinsci.plugins.workflow.cps.GroovyClassLoaderWhitelist.permitsStaticMethod(GroovyClassLoaderWhitelist.java:56)
            	at …
            	at WorkflowScript.run(WorkflowScript:1)
            	at …
            Finished: FAILURE
            
            Show
            jglick Jesse Glick added a comment - In a fresh 2.7.19.1 instance: Started by user admin [Pipeline] End of Pipeline java.lang.UnsupportedOperationException: Calling public static java.util.List org.codehaus.groovy.runtime.DefaultGroovyMethods.findAll(java.util.List,groovy.lang.Closure) on a CPS-transformed closure is not yet supported (JENKINS-26481); encapsulate in a @NonCPS method, or use Java-style loops at org.jenkinsci.plugins.workflow.cps.GroovyClassLoaderWhitelist.checkJenkins26481(GroovyClassLoaderWhitelist.java:86) at org.jenkinsci.plugins.workflow.cps.GroovyClassLoaderWhitelist.permitsStaticMethod(GroovyClassLoaderWhitelist.java:56) at … at WorkflowScript.run(WorkflowScript:1) at … Finished: FAILURE
            Hide
            jglick Jesse Glick added a comment -

            Note that this check only happens in sandbox mode currently.

            Show
            jglick Jesse Glick added a comment - Note that this check only happens in sandbox mode currently.
            Hide
            ssutherland Sean Sutherland added a comment -

            What is the reason for this check not occurring in non-sandbox mode? If the CPS transformation isnt going to happen either way, I still need to know about it even if I'm not using the sandbox

            Show
            ssutherland Sean Sutherland added a comment - What is the reason for this check not occurring in non-sandbox mode? If the CPS transformation isnt going to happen either way, I still need to know about it even if I'm not using the sandbox
            Hide
            jglick Jesse Glick added a comment -

            What is the reason for this check not occurring in non-sandbox mode?

            Because that is where the current implementation lies; there is no such hook without a sandbox.

            Show
            jglick Jesse Glick added a comment - What is the reason for this check not occurring in non-sandbox mode? Because that is where the current implementation lies; there is no such hook without a sandbox.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              ssutherland Sean Sutherland
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: