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

Custom Checkbox Parameter plugin : not working properly in pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • None
    • custom checkbox parameter : 1.1
      jenkins : 2.222.4

      I just tried the "custom checkbox parameter" plugin that perfectly fits my needs.

      When I define it from the UI, it works perfectly.

       However, when I use the snippet provided by the Declarative Directive Generator :

      parameters {
       checkboxParameter description: 'any description', format: 'JSON', name: 'SELECT_NODES', submitContent: '{"CheckboxParameter": [
      {"key": "node1","value": "node1"}
      ,{"key": "node2","value": "node2"},{"key": "node3","value": "node3"},{"key": "node4","value": "node4"}]}', useInput: true
       }
      

      It fails when I run the job : 

      no parameter is displayed.
      only "select all" option is visible and I get the error

       

      Failed to get file: URI needs to start with http or https
      

       

      If I try to build the job anyway, I get the following error

      java.lang.ClassCastException: com.bluersw.CheckboxParameterDefinition.useInput expects class net.sf.json.JSONObject but received class java.lang.Boolean
       at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:492)
       at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:409)
       at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:329)
       at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:272)
       at sun.reflect.GeneratedMethodAccessor53523.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
       at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
       at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:47)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callSafe(AbstractCallSite.java:87)
       at org.jenkinsci.plugins.pipeline.modeldefinition.Utils.instantiateDescribable(Utils.groovy:457)
       at org.jenkinsci.plugins.pipeline.modeldefinition.Utils$instantiateDescribable$2.call(Unknown Source)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
       at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
       Caused: java.lang.IllegalArgumentException: Could not instantiate {description=any description, format=JSON, name=SELECT_NODES, submitContent={"CheckboxParameter": [
      {"key": "node1","value": "node1"}
      ,{"key": "node2","value": "node2"},{"key": "node3","value": "node3"},{"key": "node4","value": "node4"}]}, useInput=true} for com.bluersw.CheckboxParameterDefinition
       at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:334)
       at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:272)
       at sun.reflect.GeneratedMethodAccessor53523.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
       at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
       at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:47)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callSafe(AbstractCallSite.java:87)
       at org.jenkinsci.plugins.pipeline.modeldefinition.Utils.instantiateDescribable(Utils.groovy:457)
       at org.jenkinsci.plugins.pipeline.modeldefinition.Utils$instantiateDescribable$2.call(Unknown Source)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
       at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
       at WorkflowScript.run(WorkflowScript)
       at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(ModelInterpreter.groovy:60)
       at WorkflowScript.run(WorkflowScript:1)
       at __cps.transform__(Native Method)
       at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:86)
       at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
       at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
       at sun.reflect.GeneratedMethodAccessor862.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.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
       at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
       at sun.reflect.GeneratedMethodAccessor863.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:129)
       at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
       at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
       at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
       at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400)
       at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
       at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312)
       at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276)
       at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
       at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
       at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
       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)
       Finished: FAILURE
      

       

      I took a look at the code of the plugin and I don't understand how

      useInput: true
      

       
      provided by the generator could fit the implementation of the plugin (where the useInput field in a net.sf.json.JSONObject)

       Also, I didn't succeed in making the plugin works with pipeline...

      Any idea will be kindly accepted

            bluersw Sun WeiSheng
            giom Guillaume
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: