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

Saving a job with Active Choice 1.4 parameters after upgrade to v1.5 resets scriptlet parameters

      After upgrading to the Active Choices v1.5 jobs originally containing Active Choices v1.4 definitions load and work fine. However, if the configuration of one of these jobs now gets saved (you don't even need to modify it) all parameters to scriptlets used in Active Choices are dropped and the form UI does not render.

      See attached screenshot on the parameter definition changes before and after the configuration is changed.

          [JENKINS-39620] Saving a job with Active Choice 1.4 parameters after upgrade to v1.5 resets scriptlet parameters

          Thanks for testing it out Paul.

          I've successfully reproduced the issue this time. I was paying attention to the transient issue we had recently, but wasn't specifically looking at scriptler parameters.

          Besides adding script-security-plugin, we have also upgraded dependencies - including scriptler-plugin. Scriptler Plugin API changed, and one part of the changes broke the UI. I have it working locally, and it's persisting the values. But I'm getting a different - and strange - error when the script is evaluated.

          Nov 16, 2016 11:26:33 AM org.biouno.unochoice.AbstractScriptableParameter eval
          SEVERE: Error executing script for dynamic parameter
          java.lang.RuntimeException: Failed to evaluate script: No signature of method: Script1.$() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@4d74e7af]
          Possible solutions: is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure), use([Ljava.lang.Object;)
          	at org.biouno.unochoice.model.GroovyScript.eval(GroovyScript.java:182)
          	at org.biouno.unochoice.model.ScriptlerScript.eval(ScriptlerScript.java:115)
          	at org.biouno.unochoice.util.ScriptCallback.call(ScriptCallback.java:96)
          	at org.biouno.unochoice.AbstractScriptableParameter.eval(AbstractScriptableParameter.java:233)
          	at org.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:196)
          	at org.biouno.unochoice.AbstractCascadableParameter.getChoicesForUI(AbstractCascadableParameter.java:137)
          	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          	at java.lang.reflect.Method.invoke(Method.java:498)
          	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:320)
          	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:163)
          	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
          	at org.kohsuke.stapler.MetaClass$JavaScriptProxyMethodDispatcher.doDispatch(MetaClass.java:474)
          	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
          	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
          	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
          	at org.kohsuke.stapler.MetaClass$11.dispatch(MetaClass.java:380)
          	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
          	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
          	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:813)
          	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
          	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
          	at org.kohsuke.stapler.Stapler.service(Stapler.java:199)
          	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
          	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
          	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
          	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
          	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
          	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
          	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
          	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
          	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
          	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
          	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
          	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
          	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
          	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553)
          	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
          	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
          	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
          	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
          	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
          	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
          	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
          	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
          	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
          	at org.eclipse.jetty.server.Server.handle(Server.java:499)
          	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
          	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
          	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
          	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
          	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
          	at java.lang.Thread.run(Thread.java:745)
          Caused by: groovy.lang.MissingMethodException: No signature of method: Script1.$() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@4d74e7af]
          Possible solutions: is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure), use([Ljava.lang.Object;)
          	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
          	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78)
          	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
          	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
          	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
          	at Script1.run(Script1.groovy:1)
          	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580)
          	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)
          	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
          	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:168)
          	at org.biouno.unochoice.model.GroovyScript.eval(GroovyScript.java:170)
          	... 60 more
          
          

          So I'm currently debugging this issue, that happens only for Scriptler scripts. Groovy scripts work fine.

          Bruno P. Kinoshita added a comment - Thanks for testing it out Paul. I've successfully reproduced the issue this time. I was paying attention to the transient issue we had recently, but wasn't specifically looking at scriptler parameters. Besides adding script-security-plugin, we have also upgraded dependencies - including scriptler-plugin. Scriptler Plugin API changed, and one part of the changes broke the UI. I have it working locally, and it's persisting the values. But I'm getting a different - and strange - error when the script is evaluated. Nov 16, 2016 11:26:33 AM org.biouno.unochoice.AbstractScriptableParameter eval SEVERE: Error executing script for dynamic parameter java.lang.RuntimeException: Failed to evaluate script: No signature of method: Script1.$() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@4d74e7af] Possible solutions: is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure), use([Ljava.lang.Object;) at org.biouno.unochoice.model.GroovyScript.eval(GroovyScript.java:182) at org.biouno.unochoice.model.ScriptlerScript.eval(ScriptlerScript.java:115) at org.biouno.unochoice.util.ScriptCallback.call(ScriptCallback.java:96) at org.biouno.unochoice.AbstractScriptableParameter.eval(AbstractScriptableParameter.java:233) at org.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:196) at org.biouno.unochoice.AbstractCascadableParameter.getChoicesForUI(AbstractCascadableParameter.java:137) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:320) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:163) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96) at org.kohsuke.stapler.MetaClass$JavaScriptProxyMethodDispatcher.doDispatch(MetaClass.java:474) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.MetaClass$11.dispatch(MetaClass.java:380) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:813) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649) at org.kohsuke.stapler.Stapler.service(Stapler.java:199) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:745) Caused by: groovy.lang.MissingMethodException: No signature of method: Script1.$() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@4d74e7af] Possible solutions: is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure), use([Ljava.lang.Object;) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) at Script1.run(Script1.groovy:1) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:168) at org.biouno.unochoice.model.GroovyScript.eval(GroovyScript.java:170) ... 60 more So I'm currently debugging this issue, that happens only for Scriptler scripts. Groovy scripts work fine.

          All right, just a typo in my Scriptler script

          Attaching a new version. Could you give it a try again Paul, please?

          Bruno P. Kinoshita added a comment - All right, just a typo in my Scriptler script Attaching a new version. Could you give it a try again Paul, please?

          Note: the latest attached hpi was built from the code that is currently in the master branch. In case it is confirmed this fixes this issue, we can release 1.5.2 straight away

          Bruno P. Kinoshita added a comment - Note: the latest attached hpi was built from the code that is currently in the master branch. In case it is confirmed this fixes this issue, we can release 1.5.2 straight away

          Paul Martin added a comment -

          Hi Bruno,

          Success! I tried it locally (as I don't have access to install plugins on our TEST server) and it worked. I'll confirm tomorrow that it works in our TEST environment but my bet is that it will.

          Thanks!

          Paul

          Paul Martin added a comment - Hi Bruno, Success! I tried it locally (as I don't have access to install plugins on our TEST server) and it worked. I'll confirm tomorrow that it works in our TEST environment but my bet is that it will. Thanks! Paul

          Excellent! Great news Paul.

          Once you confirm it worked on your test environment, I'll push the new version to the update center.

          Cheers
          Bruno

          Bruno P. Kinoshita added a comment - Excellent! Great news Paul. Once you confirm it worked on your test environment, I'll push the new version to the update center. Cheers Bruno

          Hi again Paul, there was a duplicate issue posted. So I'm tempted to release 1.5.2 tonight (it's 2 PM my time now) with this fix.

          What do you think?

          Bruno P. Kinoshita added a comment - Hi again Paul, there was a duplicate issue posted. So I'm tempted to release 1.5.2 tonight (it's 2 PM my time now) with this fix. What do you think?

          Paul Martin added a comment -

          Go for it. If nothing else, v1.5.1 should probably be taken down.

          Paul Martin added a comment - Go for it. If nothing else, v1.5.1 should probably be taken down.

          Released with 1.5.2 one hour ago

          Bruno P. Kinoshita added a comment - Released with 1.5.2 one hour ago

          Paul Martin added a comment -

          Works in our TEST environment!

          Paul Martin added a comment - Works in our TEST environment!

          Active Choices v1.5.2 works for me too! Thanks kinow! Well done!!

          Ioannis Moutsatsos added a comment - Active Choices v1.5.2 works for me too! Thanks kinow ! Well done!!

            kinow Bruno P. Kinoshita
            ioannis Ioannis Moutsatsos
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: