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

Unable to use shared library with name 'h.groovy' in pipeline with White Source plugin

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: whitesource-plugin
    • Labels:
      None
    • Environment:
      Jenkins: 2.89.4
      Plugin: whitesource 18.8.2
    • Similar Issues:

      Description

      When the White Source plugin is installed and active and you are using a shared library script called 'h.groovy' in your pipeline, you receive this error:

      java.lang.NoSuchMethodException: h.<init>()
       at java.lang.Class.getConstructor0(Class.java:3082)
       at java.lang.Class.newInstance(Class.java:412)
       at org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable.getValue(UserDefinedGlobalVariable.java:54)
       at org.jenkinsci.plugins.workflow.cps.CpsScript.getProperty(CpsScript.java:135)
       at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:174)
       at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:456)
       at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:290)
       at org.kohsuke.groovy.sandbox.GroovyInterceptor.onGetProperty(GroovyInterceptor.java:68)
       at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:326)
       at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:288)
       at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:292)
       at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)
       at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)
       at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29)
       at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
       Caused: java.lang.InstantiationException: h
       at java.lang.Class.newInstance(Class.java:427)
       at org.jenkinsci.plugins.workflow.cps.global.UserDefinedGlobalVariable.getValue(UserDefinedGlobalVariable.java:54)
       at org.jenkinsci.plugins.workflow.cps.CpsScript.getProperty(CpsScript.java:135)
       at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:174)
       at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:456)
       at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:290)
       at org.kohsuke.groovy.sandbox.GroovyInterceptor.onGetProperty(GroovyInterceptor.java:68)
       at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:326)
       at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:288)
       at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:292)
       at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)
       at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)
       at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29)
       at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
       at WorkflowScript.run(WorkflowScript:14)
       at __cps.transform__(Native Method)
       at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:74)
       at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
       at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
       at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
       at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
       at com.cloudbees.groovy.cps.Next.step(Next.java:83)
       at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
       at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
       at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122)
       at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261)
       at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
       at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$101(SandboxContinuable.java:34)
       at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.lambda$run0$0(SandboxContinuable.java:59)
       at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
       at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:58)
       at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174)
       at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:332)
       at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:83)
       at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:244)
       at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:232)
       at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
       at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
       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)

      Once you disable the plugin, the pipeline job will run successfully. There may be other shared library script names that could be affected as well, but this is the only one I have found so far. Also, this issue was not present in version 1.7.8 of the plugin.

      Steps to reproduce:

      1. Install the White Source plugin
      2. create a shared library script called 'h.groovy' and put it in the 'vars' directory. For example:

       

      def helloWorld() { echo "Hello World! I am h!" }
      return null;
      

       

      3. Create a pipeline job and call the hello world method in the pipeline using

      h.helloWorld()

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ddewhurst Dylan Dewhurst
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: